This is a part of my code
!$OMP PARALLEL DO DEFAULT(NONE) &
!$OMP PRIVATE(il,ie,iie,ienrp,iend) &
!$OMP PRIVATE(temp,spec,xa,ya) &
!$OMP SHARED(ap1,ap2,ap3,ap4,ap6,ap7) &
!$OMP SHARED(ap8,ap9,ap10,ap11,ap12,ap13) &
!$OMP SHARED(MAP,SRL,seed,de,xxa,yya,e,istart)
do iend=9,63,lorbit
e=e+de
iie=0
ienrp=ienrp+1
call hop(il,e,ienrp,map,srl,ap1, &
ap6,ap7,ap8,ap9,ap10,ap11, &
ap12,ap13,ap2,ap3,ap4,xa,ya)
istart=iend+1
write(*,'(".",$)')
end do
!$OMP END PARALLEL DO
the subroutine HOP has many other variable other then the arguments.
should i declare them as private/shared as well? if yes, when where
should i declare it? in the main code or in the HOP itself?
|
|
0
|
|
|
|
Reply
|
bnrj.rudra (343)
|
1/11/2009 2:14:33 PM |
|
rudra wrote:
> This is a part of my code
>
> !$OMP PARALLEL DO DEFAULT(NONE) &
> !$OMP PRIVATE(il,ie,iie,ienrp,iend) &
> !$OMP PRIVATE(temp,spec,xa,ya) &
> !$OMP SHARED(ap1,ap2,ap3,ap4,ap6,ap7) &
> !$OMP SHARED(ap8,ap9,ap10,ap11,ap12,ap13) &
> !$OMP SHARED(MAP,SRL,seed,de,xxa,yya,e,istart)
> do iend=9,63,lorbit
> e=e+de
> iie=0
>
> ienrp=ienrp+1
> call hop(il,e,ienrp,map,srl,ap1, &
> ap6,ap7,ap8,ap9,ap10,ap11, &
> ap12,ap13,ap2,ap3,ap4,xa,ya)
>
> istart=iend+1
> write(*,'(".",$)')
> end do
> !$OMP END PARALLEL DO
>
> the subroutine HOP has many other variable other then the arguments.
> should i declare them as private/shared as well? if yes, when where
> should i declare it? in the main code or in the HOP itself?
There are a number of things questionable here; although a lot of
code is missing (including initializations), so that I am probably
missing some things. As a start:
Certainly, e should not be SHARED, nor are the formulas for e, ienrp,
and istart safe; probably you should find the formulas for them in terms
of IEND and make them PRIVATE.
I've no clue what's going on with iie, nor what's happening inside
hop() to all those arguments -- are any of them INTENT(OUT)? If so,
the whole enterprise is questionable.
|
|
0
|
|
|
|
Reply
|
carlie (79)
|
1/12/2009 1:16:53 PM
|
|
On Jan 12, 8:16=A0am, "Carlie J. Coats" <car...@jyarborough.com> wrote:
> rudra wrote:
> > This is a part of my code
>
> > !$OMP =A0PARALLEL DO DEFAULT(NONE) &
> > !$OMP =A0PRIVATE(il,ie,iie,ienrp,iend) &
> > !$OMP =A0PRIVATE(temp,spec,xa,ya) &
> > !$OMP =A0SHARED(ap1,ap2,ap3,ap4,ap6,ap7) &
> > !$OMP =A0SHARED(ap8,ap9,ap10,ap11,ap12,ap13) &
> > !$OMP =A0SHARED(MAP,SRL,seed,de,xxa,yya,e,istart)
> > =A0 =A0 =A0 =A0 =A0do iend=3D9,63,lorbit
> > =A0 =A0 =A0 =A0 e=3De+de
> > =A0 =A0 =A0 =A0 iie=3D0
>
> > =A0 =A0 =A0 =A0 =A0 =A0ienrp=3Dienrp+1
> > =A0 =A0 =A0 =A0 =A0 =A0call hop(il,e,ienrp,map,srl,ap1, =A0 =A0&
> > =A0 =A0 =A0 =A0 =A0 ap6,ap7,ap8,ap9,ap10,ap11, =A0&
> > =A0 =A0 =A0 =A0 =A0 ap12,ap13,ap2,ap3,ap4,xa,ya)
>
> > =A0 =A0 =A0 =A0 istart=3Diend+1
> > =A0 =A0 =A0 write(*,'(".",$)')
> > =A0 =A0 =A0 =A0 =A0end do
> > !$OMP END PARALLEL DO
>
> > the subroutine HOP has many other variable other then the arguments.
> > should i declare them as private/shared as well? if yes, when where
> > should i declare it? in the main code or in the HOP itself?
>
> There are a number of things questionable here; although a lot of
> code is missing (including initializations), so that I am probably
> missing some things. =A0As a start:
>
> Certainly, e should not be SHARED, nor are the formulas for e, ienrp,
> and istart safe; probably you should find the formulas for them in terms
> of IEND and make them PRIVATE.
>
> I've no clue what's going on with iie, nor what's happening inside
> hop() to all those arguments -- are any of them INTENT(OUT)? =A0If so,
> the whole enterprise is questionable.
Besides the points made by Carlie, you need to compile the subroutine
as re-entrant and make it recursive you run the risk of all threads
using the same stack. They way I do that is to add a line to the
subroutine before the "subroutine statement" as:
!$omp recursive &
subroutine sub1(...
Notice that all variables that are internal to the recursive sub1 are
private.
HTH
Jomar
|
|
0
|
|
|
|
Reply
|
jomarbueyes (182)
|
1/12/2009 8:32:44 PM
|
|
|
2 Replies
56 Views
(page loaded in 0.108 seconds)
Similiar Articles: problem in interface - comp.lang.fortran... be a silly question and/or i am missing a faq but plz help me. I have a subroutine ... is compiled without > openmp while those in ASR is with openmp. But the subroutine ... Windows API programming with gfortran or g95 - comp.lang.fortran ...... there was some discussion about "decorating" function ... some 3D graphics eventually. Thanks for your help ... (An exception is OpenMP which uses !$OMP.) !DIR$ is ... Should I use C++ or Java for Numeric Intensive Calculations - comp ...Implementation of OpenMP and MPI (both MPI-1 and MPI-2) [3 ... nice" things C++ has: These are mainly - Class and function templates - Operator overloading - Superbe support ... Problem with DLLs created with MATLAB Compiler - comp.soft-sys ...However I haven't tried running an executable that runs a DLL compiled with MATLAB. The Mathworks tech support can help you - they helped me with a tricky compiler ... problem with mixed c and fortran code - comp.lang.fortran ...(question forwarded from from gnu.gcc.help) Hi, hope someone can explain what ... two different pointers cp1 and cp2 to stay different, but after the fortran function ... GUI for Fortran programs - comp.lang.fortranIt calls the Fortran > =A0 =A0 subroutine and assigns a new ... quad-core processor, since the Fortran is using OpenMP ... deal with complicated GUI toolkits, f2py doesn't support ... Sockets in gfortran? - comp.lang.fortran... Gib that I was leaving out part of the story, and this detail could really help ... client2.c client2.c:43: warning: unused parameter sig client2.c: In function ... gfortran or ifort? - comp.lang.fortranIn terms of Fortran 2003/2008 support [1], ifort is ... accepts, like a "rand(0)" call inside a pure function ... OpenMP "not working ... I use the ifort compiler, no ... Need a FORTRAN compiler for Win7 (or XP) - comp.lang.fortran ...... exe Select all (which I did), or gfortran + OpenMP, or... ... prefix=3D/ mingw32tdm --enable-cxx-flags=3D'-fno-function ... right. > > Here's the directory structure and the Help ... Where did Fortran go? - comp.lang.fortranAnd, FWIW, nearly everyone I work with uses MPI heavily, with some OpenMP ... it, while someone else is still searching google for a Fortran function or library to help ... OpenMP - High Performance Computing: High Performance ComputingThe idea of a subroutine that can be scheduled to run autonomously might help explain what a thread is. ... Implementations may or may not support all OpenMP API ... OpenMP in Visual C++ - Microsoft Corporation: Software .../openmp (Enable OpenMP 2.0 Support) Causes the compiler to process #pragma omp. Predefined Macros. Names the predefined ANSI C and Microsoft C++ implementation macros. 7/26/2012 8:18:54 PM
|