I have a very specific question. My fortran code produces a “Ax=b” matrix and vectors and I would like to solve it using a family of functions that is written in C which is also Cuda enabled.
How would I start to link my values from fortran to the solver on C using PGI?
Could you please guide me on where I might find the necessary steps?
I would suggest start by reading Chapter 13, Inter-language Calling, of the PGI Compiler User’s Guide. It give a good overview of the issues you may encounter.
Also, I’d recommend reading about the F2003 iso_c_binding intrinsic module. This module greatly simplifies interoperability with C.
Finally, calling CUDA C from CUDA Fortran follows the same Fortan to C conventions as above. However, I highly recommend using iso_c_binding if you’re going to call CUDA C global kernels directly since you’ll need an interface block describing the call. While this article I wrote is a bit old, it does have an example of CUDA Fortran calling CUDA C. See: Account Login | PGI
As is obvious, I am new to coding. I am looking at the Monte Carlo Integration example and it is very helpful in understanding many things, I am grateful for all the support.
I am just lost in one thing…could you please tell me the exact steps of getting the makefile to start? Do I have to use PGI Bash (64) or will PGI Cmd (64) run it too? I call the directory where “pgi_mc_example” folder exists…and then?
On Windows, you’ll want to use the Cygwin (bash) environment since DOS doesn’t support Make.
I wrote that article with Linux in mind and don’t think I tested it on Windows. Though, that’s why we ship Cygwin, so folks a have Unix like environment and access to these tools. I don’t think you’ll have a problem with the code, but may need to adjust paths and make sure nvcc can be invoked (if you’re doing the mixed CUDA C portion). Also, you’ll most likely need to figure out what symbol name nvcc gives the random number generator routine.
I’m a bit swapped today but I can, I’ll try the example myself on Windows and see what I encounter.
Thank you for the very helpful replies Mat.
Is this the nvcc incompatibility you had predicted?
I do have MVS 2010 installed and CUDA 5.5.
Any ideas on what I could do next?
I hope that I am not boring you to death. :)