PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

GPU accelerator with hybrid C/C++ code

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



Joined: 07 Jun 2012
Posts: 2

PostPosted: Thu Jun 07, 2012 5:11 am    Post subject: GPU accelerator with hybrid C/C++ code Reply with quote

Dear all,
I'd like to post a general problem related to the usage of GPU accelerator capabiliy of the PGI compiler. In particular I'm wondering if it is possible to compile a GPU-accelerated executable from hybrid C/C++ algorithm.
To be more specific, I wrote a C++ program that contains a loop that I'd like to parallelize on GPU. However, I noticed that the pgCC (and the other c++ compilers) does not accept the -ta flag. Thus, I decided to implement a C routine containing the part that needs parallelization, add the accelerator pragma, compile this file with "pgcc -ta=host,nvidia" and then link the resulting object with all the other ones. However, when I try to link all the objects (with pgCC) I get the errors that are reported at the end of this post. Am I doing somenthing wrong or is it impossible to produce a C/C++ mixed code parallelized for GPU?
Thank you in advance for all the kind answers,

Mirco Zerbetto


    func.o: In function `function.pgi.uni.gpu':
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:23: undefined reference to `__pgi_cu_init'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:23: undefined reference to `__pgi_cu_module3'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:23: undefined reference to `__pgi_cu_module_function3'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:23: undefined reference to `__pgi_cu_module_function3'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:23: undefined reference to `__pgi_cu_alloc_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:23: undefined reference to `__pgi_cu_uploadx_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:23: undefined reference to `__pgi_cu_datadone_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:27: undefined reference to `__pgi_cu_alloc_t'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:27: undefined reference to `__pgi_cu_uploadc_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:27: undefined reference to `__pgi_cu_launch_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:27: undefined reference to `__pgi_cu_launch_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:27: undefined reference to `__pgi_cu_downloadc_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:36: undefined reference to `__pgi_cu_free_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:36: undefined reference to `__pgi_cu_free_a'
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:36: undefined reference to `__pgi_cu_close'
    func.o: In function `function.test':
    /local/home/polimeno/zerbetto/software/jemdi_beta_03/./func.c:40: undefined reference to `__pgi_unified_version_selector8'
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Jun 07, 2012 11:33 am    Post subject: Reply with quote

Hi Mirco Zerbetto,

Quote:
I wrote a C++ program that contains a loop that I'd like to parallelize on GPU. However, I noticed that the pgCC (and the other c++ compilers) does not accept the -ta flag
Correct. C++ support for the PGI Accelerator Model and OpenACC is currently expected in 13.x release due late 2012 or early 2013.

Quote:
Am I doing somenthing wrong or is it impossible to produce a C/C++ mixed code parallelized for GPU?
This error indicates that you are missing the Accelerator libraries. Which compiler are you using to link and what options are you using?

Assuming you are using pgCC to link, you can either add the libraries "-lacc1 -ldl" to your link options or instead link using pgcc with "-ta=host,nvidia" plus the "-pgcpplibs" flags. This will link in both the C++ and Accelerator libraries.

Hope this helps,
Mat
Back to top
View user's profile
mirco.zerbetto



Joined: 07 Jun 2012
Posts: 2

PostPosted: Fri Jun 08, 2012 1:35 am    Post subject: Reply with quote

Dear Mat,

thank you so much for your kind help. I was able to compile the code using both your suggestions.

Best regards,

Mirco
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