- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi out there,
I would like lock-free join two linked list in Fortran+OpenMP.
Therefore I need to change a pointer atomically. This should not be any problem in C/C++, but in Fortran I do not manage to :(
The following code is rejected by the Intel Compiler with the error:
error #7646: A store statement is expected in an OpenMP* ATOMIC construct.
!$omp atomic
last_job%next => tmp_first_job
!$omp end atomic
Is there any work-around?
Will there be support of the "=>" operation in future?
regards,
Jens Henrik
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
just an additional remark:
I cannot use the following as an alternative, because ifort gives the error:
error #7656: Subobjects are not allowed in this OpenMP* clause; a named variable must be specified. [NEXT]
last_job%next => tmp_first_job
!$omp flush (last_job%next)
but just using !$omp flush(last_job) will probably only flush the pointer to the structure of "last_job" and not of the "next" pointer inside the structure.
Any idea ?
regards,
Jens Henrik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please provide a small copy of your linked list code. What you have in your first example is not indicative of a functionally correct, thread-safe, linked list management piece of code. This would typically require an !$OMP CRITICAL section or use of a CAS or DCAS type of implimentation.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming that atomic applies only to simple data items, it might work with a c_ptr, but I wouldn't recommend it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The documented requirements for OMP$ ATOMIC say that "all assignments must be intrinsic assignments". Pointer assignment doesn't comply.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page