PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

multiple module management with cuda fortran?

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
vibrantcascade



Joined: 04 Aug 2011
Posts: 28

PostPosted: Thu Aug 30, 2012 2:14 pm    Post subject: multiple module management with cuda fortran? Reply with quote

As far as I can tell, in order for a module meant to be a cuda kernel to compile properly, it has to be included in a program initially and it can't be compiled on its own in a separate *.f because it will give an error such as:

[leiderml@ebwilson-mpi ~]$ pgfortran -Mcuda=cc20 cudaCase8.f
/shared/pgi/linux86-64/11.5/lib/f90main.o: In function `main':
f90main.c:(.text+0x3c): undefined reference to `MAIN_'

But after the module has been compiled it appears you can remove the module code from the same *.f file that contains your main program as long as you don't need to change the module.

Is there a way to keep my cuda modules in entirely separate *.f files from the main program but still have them compile properly? I'm at the point where I'm going to have my main program calling into 9 different cuda modules depending on which code path is taken, and I'd really like to break up the extra 10,000 lines of code into different files to keep it more manageable while I'm doing my testing and debugging.


Thanks!
Morgan
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5952
Location: The Portland Group Inc.

PostPosted: Thu Aug 30, 2012 2:34 pm    Post subject: Reply with quote

Hi Morgan,

Quote:
leiderml@ebwilson-mpi ~]$ pgfortran -Mcuda=cc20 cudaCase8.f
/shared/pgi/linux86-64/11.5/lib/f90main.o: In function `main':
f90main.c:(.text+0x3c): undefined reference to `MAIN_'
You just need to add the "-c" flag to tell the compiler to stop after compilation. This error just means that it tried to link your program but couldn't find the main entry point.

Quote:
Is there a way to keep my cuda modules in entirely separate *.f files from the main program but still have them compile properly?
Sure. Compile the files with "-c" and then add the resulting object file (.o) to the final link line.

Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group