Problem after converting from F77 to F90

General OpenMP discussion

Problem after converting from F77 to F90

Postby quarkz » Tue Mar 03, 2009 6:29 pm

Hi,

I've an old code in F77 with openmp. After using to_f90 to convert to F90 free source format, there 's error during openmp compilation. If I didn't specify -openmp for ifort, then there's no problem.

The openmp syntax used is :

!$OMP PARALLEL DO
!$OMP1SHARED(U, V, W, UR, VR, WR)
!$OMP2 PRIVATE(K, KM1, KP1, J, JM1, JP1, I)
!$OMP+SCHEDULE(RUNTIME)
do i=1, ....

There's no problem compiling if it's in F77 but not in F90. There's also no "!$omp parallel end" statement in the original F77.

So how should I convert them so that I don't mess things up.

TIA!

So how should I convert them
quarkz
 
Posts: 5
Joined: Tue Mar 03, 2009 6:16 pm

Re: Problem after converting from F77 to F90

Postby ejd » Tue Mar 03, 2009 10:21 pm

The OpenMP V2.5 spec, section 2.1.2 Free Source Form Directives, states:
Continued directive lines must have an ampersand as the last nonblank character on the line, prior to any comment placed inside the directive. Continuation directive lines can have an ampersand after the directive sentinel with optional white space before and after the ampersand.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am

Re: Problem after converting from F77 to F90

Postby quarkz » Wed Mar 04, 2009 5:32 pm

Thanks ejd,

I've changed to

!$OMP PARALLEL DO &
!$OMP SHARED(U, V, W, UR, VR, WR) &
!$OMP PRIVATE(K, KM1, KP1, J, JM1, JP1, I) &
!$OMP SCHEDULE(RUNTIME)
do i=1, ....

and it now works. Btw, the 1, 2 and + don't mean anything right? I also found that the original F77 code doesn't 've END PARALLEL ...

Does it matters, especially after I converted the code to F90?

Thanks again!
quarkz
 
Posts: 5
Joined: Tue Mar 03, 2009 6:16 pm

Re: Problem after converting from F77 to F90

Postby ejd » Thu Mar 05, 2009 7:21 am

quarkz wrote:Btw, the 1, 2 and + don't mean anything right?


From the Fortran 77 standard:
3.2.3 Continuation Line.
A continuation line is any line that contains any character of the FORTRAN character set other than the character blank or the digit 0 in column 6 and contains only blank characters in columns 1 through 5. A statement must not have more than nineteen continuation lines.

Quite often people will use numbers so they would know how many continuation lines they have (so they don't exceed the maximum).


quarkz wrote:I also found that the original F77 code doesn't 've END PARALLEL ...

Does it matters, especially after I converted the code to F90?

In the code you have shown, the directive used was "parallel do", which is a combined worksharing directive. If you look at the OpenMP V2.5 spec, section 2.6.1 Parallel loop construct states:
The syntax of the parallel loop construct is as follows:

!$omp parallel do [clause[[,] clause] ...]
do-loop
[!$omp end parallel do]

...
If an end parallel do directive is not specified, an end parallel do directive is assumed at the end of the do-loop.
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am

Re: Problem after converting from F77 to F90

Postby quarkz » Fri Mar 06, 2009 4:46 am

Oh I understand now. Thanks alot. My F90 code is finally working :D
quarkz
 
Posts: 5
Joined: Tue Mar 03, 2009 6:16 pm


Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 7 guests

cron