PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

call thrust::min_element function from cuda fortran
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
mkcolg



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

PostPosted: Mon Apr 16, 2012 9:34 am    Post subject: Reply with quote

Hi brute11k,

Quote:
Well, about zero-based indexes, I'm using array unrolling to avoid designing functions for various
My comment about indices is for C to Fortran conversion. Without it, you'll be off by one. You just need to either add one to the return index, or declare your Fortran arrays with a zero lower bound.

Quote:
You'll see that this is sort of a ugly code, because every time we need to access variables "i, j, k" to get the needed value. "idx" here looks more compact, faster
Either method will work so long as the threads in your blocks are accessing memory as contiguous blocks. Personally, I prefer using the explicit dimensions since it's easier to keep track of the indexing. Fortran is column-major, meaning that the contiguous memory segment is the first dimension. So if the "i" index is your first column, you should be striding across this dimension and not "k". This is the opposite as C which is row-major.

Note, your program has a major issue which is preventing the kernels from launching. Take a look at your launch configuration. Can you tell what's wrong? Also, especially during development, adding error checking after your kernel launches to ensure your kernels are executing.

For example:
Code:

                call calculate3D<<<blocks>>>(DIM3_dev3, DIM3_dev2, DIM3_dev1)
                istat = cudaGetLastError()
                if (istat .gt. 0) then
                    print *, cudaGetErrorString(istat)
                    STOP
                 end if
                counter = counter+1


- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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