magma_zgemm failure: Assertion failed in constants.cpp

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
achilles0613
Posts: 2
Joined: Tue Jun 30, 2015 2:05 pm

magma_zgemm failure: Assertion failed in constants.cpp

Post by achilles0613 » Tue Jun 30, 2015 3:35 pm

Hello,

I'm trying to use a serial code of mine with magma functions replacing the corresponding lapack ones. I have been running into a lot of problems. The most detailed is when calling the function:

Code: Select all

call magma_zgemm(MagmaNoTrans,MagmaNoTrans,M,N,N,alpha,L,M,U,M,beta,X,M)
I get the following error:
constants.cpp:349: const char* lapack_trans_const(magma_trans_t): Assertion `magma_const <= MagmaConjTrans' failed.
Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0 0x2AF5944A6377
#1 0x2AF5944A697E
#2 0x3FC26302CF
#3 0x3FC2630265
#4 0x3FC2631D0F
#5 0x3FC2629705
#6 0x40271F in lapack_trans_const
#7 0x4017F9 in magma_zgemm
#8 0x401358 in MAIN__ at MagmaProblem.f90:0
Aborted
I also get similar assertion fails for other instances of similar function calls (ztrsm included). If someone knows a fix for this it would be awesome.

I'm using magma 1.6.2 with acml 5.3.0 or 5.3.1 (played around with both) and cuda 6.0. The library and all necessary files build fine, but the testing folder fails with trying to find some libraries. I think this is inconsequential but if it's necessary I'd be happy to isolate the issues with that.

Finally, a stripped down version that produces the first error is below. The compilation line is:

Code: Select all

gfortran -fno-underscoring MagmaProblem.f90 -o MagmaProblem.x -I/(MAGMADIR)/control -L/contrib/gcc-4.8.2/lib64 -lquadmath -L/(MAGMADIR)/lib -lmagma -L/usr/local/cuda/lib64 -lcublas -lcudart
Note: the quadmath linker is something that only arose with this sample code. To get it to find it, I also had to add the path to my LD_LIBRARY_PATH in my bashrc (along with the cuda path which was there before)

Code: Select all

program MagmaProblem

	use magma

	implicit none
	integer, parameter :: M=20, N=20
	complex*16 :: L(M,N),U(M,N),X(M,N), alpha, beta
	
	X = 0
	L = 5
	U = 5
	alpha=cmplx(1.0,0.0)
	beta=cmplx(0.0,0.0)
	
	call magma_zgemm(MagmaNoTrans,MagmaNoTrans,M,N,N,alpha,L,M,U,M,beta,X,M)
	
end program

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: magma_zgemm failure: Assertion failed in constants.cpp

Post by mgates3 » Thu Jul 02, 2015 1:24 am

We haven't added Fortran interfaces for the BLAS functions. You are calling the MAGMA C interface from Fortran, which naturally doesn't work. Fortran is passing all the parameters as pointers, whereas C expects them by value.

Instead, you should call the cuBLAS Fortran interfaces. See the example posted here for using the cuBLAS Fortran interface:
viewtopic.php?f=2&t=1216&p=3485&hilit=Fortran#p3485

For other functions like zgetrf, MAGMA's Fortran interfaces start with magmaf_ instead of magma_, to differentiate the Fortran interface from the C interface.

By default, Fortran will not complain if an interface is missing. It's helpful to add -Wimplicit-interface to warn about this, which would immediately reveal that there is no magma_zgemm in Fortran.

Code: Select all

magma-trunk/testing> gfortran -Wimplicit-interface -fno-underscoring MagmaProblem.f90 -o MagmaProblem -I../include -L../lib -lmagma -L /usr/local/cuda-5.5/lib -lcublas -lcudart
MagmaProblem.f90:15.87:

a_zgemm(MagmaNoTrans, MagmaNoTrans, M, N, N, alpha, L, M, U, M, beta, X, M)
                                                                           1
Warning: Procedure 'magma_zgemm' called with an implicit interface at (1)
Also, you should be able to include -I $(MAGMA_DIR)/include, instead of $(MAGMA_DIR)/control. The Fortran .mod files are copied to the include directory. When MAGMA is installed (via 'make install'), the include directory is copied to $(prefix)/include.

-mark

Post Reply