Couldn't accelated fortran fixed format (f77) file?

I’m trying to accelerate our calculation program.
It is .f file and wroted in f77 fixed-formated.

I compiled it with “-ta=nvidia -Minfo”, but nothing about accelation appeared.

Even I tried to use “-Mfixed -ta=nvidia”, it doesn’t work.

Should I change my program to a free-formated file, or here’s some opinion to accelate a f77 file?

Hi tiomiya,

The PGI Accelerator model works in both free and fixed form, so something else is wrong.

Did you add “!$acc” directives to your code? If so, can you please post a small example including the compilation output?

  • Mat

I made a very small .f file.

ftest.f:
program cuda_test
use accel_lib
real a,b
a=1.0
b=1.0
call acc_init( acc_device_nvidia )
!$acc region
do i=1,50000
a=ab
enddo
!$acc end region
write(
,*) a
end

pgfortran ftest.f -ta=nvidia -Minfo
(nothing appears)
./a.out
1.000000

pgfortran ftest.f -Mfree -ta=nvidia -Minfo
cuda_test:
9, Loop is parallelizable
Accelerator kernel generated
9, !$acc do parallel, vector(256)
./a.out
launch kernel file=/home/tiomiya/test.d/./ftest.f function=cuda_test line=9 device=0 grid=196 block=256
1.000000

If I rename the .f file to .f90, it shows the accelation massage too.
But most our programs are in f77 format and must be fix to make them free format. If I use -Mfree opinion, lots of Syntax error will occur.

Is there something wrong in my usage?

Hi tiomiya,

Directives must start in column 1 when using Fixed format, otherwise they turn into inline comments.

For example:

% cat test.f
        program cuda_test
        use accel_lib
        real a,b
        a=1.0
        b=1.0
        call acc_init( acc_device_nvidia )
!$acc region
        do i=1,50000
        a=a*b
        enddo
!$acc end region
        write(*,*) a
        end

% pgfortran -V10.2 test.f -ta=nvidia -Minfo -o a1.out
cuda_test:
      8, Loop is parallelizable
         Accelerator kernel generated
          8, !$acc do parallel, vector(256)

Hope this helps,
Mat

It helps a lot.
Thank you for solving my problem. :)