magma library with long ints?

Open discussion for MAGMA

magma library with long ints?

Postby gmulas » Mon Nov 21, 2011 1:49 pm

Hello.

Some quantum chemistry programs I use (e.g. NWChem) rely on lapack and/or blas routines in which all fortran integers are promoted to long ints. Vendor libraries are usually available in such a flavour (i.e. acml and mkl are). This is necessary to be able to support large indices for some arrays. While it's trivial to obtain this for the fortran interfaces of magma (e.g. by setting the gfortran flag -i8 or the equivalent with other compilers) and for C/C++ code meant for the CPU, it's not apparent (to a CUDA newbie as me) if this can be achieved as easily for the code to be executed on the gpu and, in case, what should be the appropriate nvcc flags.

Could you magma developers please either provide an example of make.inc file to obtain this or explain if/how this can be achieved? What I need is just blas (and possibly lapack) fortran interfaces in which all integers are 64 bits.

Thanks in advance
Giacomo Mulas
gmulas
 
Posts: 4
Joined: Mon Nov 21, 2011 12:47 pm

Re: magma library with long ints?

Postby Stan Tomov » Tue Nov 22, 2011 12:48 pm

Hi,
The integers used in MAGMA are defined by magma_int_t. By default this is set to int - in file include/magmablas.h there is a definition:
Code: Select all
typedef int magma_int_t;

The reason for using this to handle cases like yours. You can redefine it to 64 bit integer and recompile the library.
Stan
Stan Tomov
 
Posts: 251
Joined: Fri Aug 21, 2009 10:39 pm

Re: magma library with long ints?

Postby gmulas » Tue Nov 22, 2011 1:29 pm

Thanks for your prompt reply, Stan.

Would you please explain how this magma_int_t is mapped to cudablas function? As far as I can understand, cudablas functions do not accept long ints as arguments, so you would have to cast them to ints. This is not a limitation of cuda per se, perhaps, but it is a limitation of using cudablas. If a number is too large to fit in an int, how is this handled? truncation? it is checked and an error is issued? In those codes, long ints are used exactly to be able to handle array indices which will not fit into an int, so it should either fall back on the cpu implementation or fail gracefully.

Thanks again
Giacomo
gmulas
 
Posts: 4
Joined: Mon Nov 21, 2011 12:47 pm

Re: magma library with long ints?

Postby Stan Tomov » Tue Nov 22, 2011 3:44 pm

Hi Giacomo,
I think the compiler will let you pass (by value) any integer type to cublas and the values will be cast. I am not sure what truncation will happen if they exceed the range. In the case of cublas though there is no need of concern for now. The smallest type in cublas is float and int can address a little more than 8 GB of floats which exceeds the memory sizes of the current GPUs.
Stan
Stan Tomov
 
Posts: 251
Joined: Fri Aug 21, 2009 10:39 pm


Return to User discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron