openmp problem

General OpenMP discussion

openmp problem

Postby rudra » Fri Dec 05, 2008 7:21 am

dear friends,
with the risk of annoying you, let me ask you my old problem once again.
400 !$ call OMP_SET_NUM_THREADS(2)
401
402 !$OMP PARALLEL DO DEFAULT(NONE) &
403 !$OMP PRIVATE(il,ie,iie,ienrp,iend,e,istart) &
404 !$OMP PRIVATE(temp,spec,xa,ya) &
405 !$OMP SHARED(ap1,ap2,ap3,ap4,ap6,ap7) &
406 !$OMP SHARED(ap8,ap9,ap10,ap11,ap12,ap13) &
407 !$OMP SHARED(MAP,SRL,seed,de,xxa,yya)
408
409 orbital: do il=1,lorbit-2,2
410 ! xa=0.0;ya=0.0
411 ! write(*,'(1x,"Starting orbital loop",1x,i1,$)') il
412 ienrp=0
413 e=emin-de
414 istart=1
415
416 do iend=9,63,lorbit
417 e=e+de
418 iie=0
419
420
421 ienrp=ienrp+1
422 call hop(il,e,ienrp,map,srl,ap1, &
423 ap6,ap7,ap8,ap9,ap10,ap11, &
424 ap12,ap13,ap2,ap3,ap4,xa,ya)
425
426 ! write(*,*) xa(2,3)
427 ! istart=iend+1
428 write(*,'(".",$)')
429 end do
430
431 call fit(xa,ya,seed,xxa,yya,temp)
432 call spectral(il,xxa,yya,temp,spec)
433 write(*,'("done")')
434
435
436 end do orbital
437 !$OMP END PARALLEL DO

this is my parallel part while the subroutine hop,fit and spectral are serial code, that i used for serial run. i have used -[f]openmp option for main code only and not on these subroutine and not parallalized them either. So, these routines are thread-unsafe. I read from a SUN tutorial that it is possible to run these thread-unsafe code inside parallel region using lock.
can anyone show me any example of using this lock? those routine contains one functions as well. Should those be pure?
rudra
 

Re: openmp problem

Postby james » Thu Dec 11, 2008 12:01 pm

Rudra,

I believe all of the OpenMP specifications contain reasonable examples of how to use OpenMP locks.

james
james
 
Posts: 54
Joined: Fri May 16, 2008 9:27 am


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron