Error: BLAS/LAPACK routine 'magma_' gave error code -7

Open discussion for MAGMA

Error: BLAS/LAPACK routine 'magma_' gave error code -7

Postby christianHEL » Thu Aug 22, 2013 2:37 pm

I was trying to run some MAGMA code in R. It works, but for matrices with many columns I get the following error message:

Code: Select all
Error: BLAS/LAPACK routine 'magma_' gave error code -7

I attached my .cpp file with my code, because the forum flagged it as spam and denied my message. I compile the .cpp in R and run the function using:

Code: Select all
library(Rcpp) 
PKG_LIBS <- sprintf('-Wl,-rpath,/usr/local/magma/lib -L/usr/local/magma/lib -lmagma /usr/local/magma/lib/libmagma.a -Wl,-rpath,/usr/local/cuda-5.5/lib64 %s', Rcpp:::RcppLdFlags())
PKG_CPPFLAGS <- sprintf('-DADD_ -DHAVE_CUBLAS -I/usr/local/magma/include -I/usr/local/cuda-5.5/include %s', Rcpp:::RcppCxxFlags()) 
Sys.setenv(PKG_LIBS = PKG_LIBS , PKG_CPPFLAGS = PKG_CPPFLAGS)
R <- file.path(R.home(component = 'bin'), 'R')
file <- '/home/christian/Dropbox/MAGMA/gpuQR_magma.cpp'
cmd <- sprintf('%s CMD SHLIB %s', R, paste(file, collapse = ' '))
system(cmd)

dyn.load('/home/christian/Dropbox/MAGMA/gpuQR_magma.so')

set.seed(100)

n_row <- 1000
n_col <- 1000
A <- matrix(rnorm(n_row * n_col), n_row, n_col)

res <- .Call('gpuQR_Rcpp', c(A), n_row, n_col)

I think that something is wrong with the lwork variable, but I am not sure. FIY, the magma_dgeqrf function in the testing folder works perfectly. Does anybody have an idea? Thanks a lot!
Attachments
gpuQR_magma.cpp
(1.72 KiB) Downloaded 45 times
christianHEL
 
Posts: 3
Joined: Thu Aug 22, 2013 2:20 pm

Re: Error: BLAS/LAPACK routine 'magma_' gave error code -7

Postby Stan Tomov » Thu Aug 22, 2013 5:55 pm

I see that the work space is indeed not large enough. You have
Code: Select all
lwork = max( lwork, max( nb, 2*nb*nb ));

but it should be
Code: Select all
lwork = max( lwork, max( n_col*nb, 2*nb*nb ));

Alternatively, you could have called directly magma_dgeqrf with work space size query (instead of lapackf77_dgeqrf).
Stan Tomov
 
Posts: 251
Joined: Fri Aug 21, 2009 10:39 pm

Re: Error: BLAS/LAPACK routine 'magma_' gave error code -7

Postby christianHEL » Fri Aug 23, 2013 3:50 pm

Thanks for your reply! It is working now and I am really amazed by the speed. I attached the final code.

Quick question:
I want to solve a linear system, but my X matrix is huge and rectangular and does not fit on the GPU. I use the magma_dgeqrf() function and could reconstruct the Q matrix myself using the elementary reflectors, but I need only the first N columns. How can I use the magma_dorgqr() function? There is the DT argument that confuses me since I did not use magma_dgeqrf_gpu().

Thanks for your help!
Attachments
gpuQR_magma.cpp
(1.04 KiB) Downloaded 40 times
christianHEL
 
Posts: 3
Joined: Thu Aug 22, 2013 2:20 pm


Return to User discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron