| View previous topic :: View next topic |
| Author |
Message |
tiomiya
Joined: 03 Dec 2009 Posts: 6
|
Posted: Thu Mar 11, 2010 3:37 am Post subject: 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? |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Thu Mar 11, 2010 10:49 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
tiomiya
Joined: 03 Dec 2009 Posts: 6
|
Posted: Thu Mar 11, 2010 2:16 pm Post subject: sample |
|
|
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=a*b
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? |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Thu Mar 11, 2010 5:44 pm Post subject: |
|
|
Hi tiomiya,
Directives must start in column 1 when using Fixed format, otherwise they turn into inline comments.
For example: | Code: | % 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 |
|
| Back to top |
|
 |
tiomiya
Joined: 03 Dec 2009 Posts: 6
|
Posted: Fri Mar 12, 2010 6:28 am Post subject: It works! |
|
|
It helps a lot.
Thank you for solving my problem. :) |
|
| Back to top |
|
 |
|