Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. OpenMP parallel file writing

OpenMP parallel file writing

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ashish Ranjan Mishra
    wrote on last edited by
    #1

    hello, Can anyone help me out in writing large number of files(almost 8000) parallely in a directory using openMP support in VC++ I am also using a recursive function inside WriteFile to do the writng texts to the corresponding file My code snippet is as below =========================== #pragma omp parallel private(i) { #pragma omp for schedule(dynamic, 1) for ( i= 0; i< 10000; i++) { WriteFiles("directory path..", "w+"); } } But it is not working and crashing particularly inside recursive function. Can anyone help me out? Thanks in advance

    asdsa

    L A D 4 Replies Last reply
    0
    • A Ashish Ranjan Mishra

      hello, Can anyone help me out in writing large number of files(almost 8000) parallely in a directory using openMP support in VC++ I am also using a recursive function inside WriteFile to do the writng texts to the corresponding file My code snippet is as below =========================== #pragma omp parallel private(i) { #pragma omp for schedule(dynamic, 1) for ( i= 0; i< 10000; i++) { WriteFiles("directory path..", "w+"); } } But it is not working and crashing particularly inside recursive function. Can anyone help me out? Thanks in advance

      asdsa

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Ashish Ranjan Mishra wrote:

      it is not working and crashing

      You will need to provide much more detail if you want help with this. We have no idea what "not working" means, or where it is crashing. Also, you need to understand that trying to write that many files at the same time will run extremely slowly as the system tries to schedule the different threads.

      1 Reply Last reply
      0
      • A Ashish Ranjan Mishra

        hello, Can anyone help me out in writing large number of files(almost 8000) parallely in a directory using openMP support in VC++ I am also using a recursive function inside WriteFile to do the writng texts to the corresponding file My code snippet is as below =========================== #pragma omp parallel private(i) { #pragma omp for schedule(dynamic, 1) for ( i= 0; i< 10000; i++) { WriteFiles("directory path..", "w+"); } } But it is not working and crashing particularly inside recursive function. Can anyone help me out? Thanks in advance

        asdsa

        A Offline
        A Offline
        Afzaal Ahmad Zeeshan
        wrote on last edited by
        #3

        Apart from the problem, you also did not show the WriteFiles function that you have. The function that you have is not recursive, it does not call itself, or does it? If that does, remove the recursion as soon as possible. Secondly, also show the code of that function. OpenMP is helpful in most cases, but multithreading can be overkill in majority of the cases. Use with caution.

        The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

        1 Reply Last reply
        0
        • A Ashish Ranjan Mishra

          hello, Can anyone help me out in writing large number of files(almost 8000) parallely in a directory using openMP support in VC++ I am also using a recursive function inside WriteFile to do the writng texts to the corresponding file My code snippet is as below =========================== #pragma omp parallel private(i) { #pragma omp for schedule(dynamic, 1) for ( i= 0; i< 10000; i++) { WriteFiles("directory path..", "w+"); } } But it is not working and crashing particularly inside recursive function. Can anyone help me out? Thanks in advance

          asdsa

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Until your code works with 1 file, non-recursively, don't bother adding the complexity of multiple files, in parallel, using recursion. Start small until you have a firm understanding, and then bother building it up.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

          1 Reply Last reply
          0
          • A Ashish Ranjan Mishra

            hello, Can anyone help me out in writing large number of files(almost 8000) parallely in a directory using openMP support in VC++ I am also using a recursive function inside WriteFile to do the writng texts to the corresponding file My code snippet is as below =========================== #pragma omp parallel private(i) { #pragma omp for schedule(dynamic, 1) for ( i= 0; i< 10000; i++) { WriteFiles("directory path..", "w+"); } } But it is not working and crashing particularly inside recursive function. Can anyone help me out? Thanks in advance

            asdsa

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hi,

            Ashish Ranjan Mishra wrote:

            But it is not working and crashing particularly inside recursive function. Can anyone help me out?

            Unfortunately you did not give any error message or debug information. Also wanted to point out that you will need to avoid the C runtime if you plan on opening more than 512/2048 files at a time. If you use the C wrappers you will be limited to 512 file handles which can be extended to 2048 via the _setmaxstdio function[^]. Best Wishes, -David Delaune

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups