PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

using 1byte, 2byte, 4byte in CUDA Fortran

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



Joined: 11 Jun 2009
Posts: 233

PostPosted: Wed Oct 30, 2013 7:29 pm    Post subject: using 1byte, 2byte, 4byte in CUDA Fortran Reply with quote

I have an array of data with values pretty small. I'm thinking of using 1byte or 2byte to save memory; but not sure if current CUDA Fortran support using 1byte, 2byte data or not? and if so, does it help much with performance as I afraid using 1byte data may take more machine instructions than using 4byte integer.

Another question is that I have an array of pairs (a,b) with values fit to 4bits. Am thinking of using an array of 8bits value; i.e. to save 'a' in the higher 4bits, and 'b' to the lower 4bits of an 8bits values. During the execution of the kernel, I need to extract 'a' and 'b' as two separate variables; does CUDA Fortran has the function to extract the higher 4bits and the lower 4bits.

Any one can comment?

Thanks,
Tuan
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Oct 31, 2013 8:30 am    Post subject: Reply with quote

Hi Tuan,

INTEGER kinds 1, 2, and 4 are all supported in CUDA Fortran as are the Fortran bit-wise intrinsics (iand,ior, ieor, ibits, ishft). So you should be able to do everything you're wanting to do.

Performance-wise, what your saving is amount of data copied. In you kernels, you'll want to convert the data to the most normal size (32 bits for a GPU) and do your integer arithmetic in that type. Instruction throughput for ints is the same as for shorts and chars in any modern architecture.

Hope this helps,
Mat
Back to top
View user's profile
Tuan



Joined: 11 Jun 2009
Posts: 233

PostPosted: Thu Oct 31, 2013 11:36 am    Post subject: Reply with quote

Thanks a lot 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