Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    ParallelFor with race conditions

    Cinema 4D SDK
    c++ windows r21 r20 maxon api
    2
    4
    613
    Loading More Posts
    • 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.
    • J
      juergenb
      last edited by

      Hallo everyone, I need to process a huge amount of data, organized in a 2d grid, like a bitmap. its more than 25 million data sets so I wanted to use ParallelFor for this.

      However, the problem is: While I can iterate over the grid to get data to process, I need to write the results from processing each dataset into several other datasets in the grid (advection). So, if i just use parallelFor, there will likely be write access to the same datasets by several threads simultaneously.

      What is the best way to do this?

      thank you!

      J

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        hello @juergenb and thanks for reaching us,

        You have to use a lock system, we have our Lock Manual with the information you will need.

        Of course if you have question feel free to ask them.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • J
          juergenb
          last edited by

          thank you!! That should get me going 🙂

          I guess it is generally smarter to try and work around locks, right? To avoid threads waiting for each other?

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by Manuel

            hi,

            that really depends on what you are doing.
            There's different type of lock for different cases and scenario.

            That also depends on what you care first, speed or memory.

            but the manual is pretty easy to understand, just pass the lock as a reference to your lambda function and you should be good to go.

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • First post
              Last post