Jump to content

  • Log In with Google      Sign In   
  • Create Account


Parallel programming question.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 TMarques   Members   -  Reputation: 189

Like
0Likes
Like

Posted 18 February 2013 - 11:34 AM

Hello,

 

My question is related to OpenCL but I guess it could be applied to any parallel API (Cuda, MPI, pThread...)

 

I have a kernel that's executed thousands of times and each parallel kernel holds a reference to a single memory space called "__global char *comp". Prior to executing the kernels, the Host initializes this "comp" memory space to "true" and, during execution, kernels only acess "comp" if it needs to assign it's value to "false".

 

Do I have to worry about memory access synchronization in this particular case? I'm thinking it wouldn't matter if two kernels acessed the memory space concurrently as the only possible outcome would be for it to have a "false" value assigned.


Tiago.MWeb Developer - Aspiring CG Programmer

Sponsor:

#2 Tribad   Members   -  Reputation: 805

Like
0Likes
Like

Posted 18 February 2013 - 11:55 AM

I think someone will check the value whether it is true or false. If it is done in a loop and it has no harm to  check it a cycle later it is seems to me ok to not do any synchronization.



#3 frob   Moderators   -  Reputation: 18937

Like
0Likes
Like

Posted 18 February 2013 - 01:53 PM

If you don't need it to be immediately synced between processes the multiple readers is fine with a single writer.

Just mark the readers as const global and it should all work well in OpenCL.
Check out my personal indie blog at bryanwagstaff.com.

#4 TMarques   Members   -  Reputation: 189

Like
0Likes
Like

Posted 18 February 2013 - 03:07 PM

If you don't need it to be immediately synced between processes the multiple readers is fine with a single writer.

Just mark the readers as const global and it should all work well in OpenCL.

 

Ok, I understand now.

 

Actually I wanted processes to have write access to memory space but I realised data can end up being corrupted even in this case if there's no synchronization.

 

Thanks for the help, Frob, Tribad!


Tiago.MWeb Developer - Aspiring CG Programmer




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS