dgetrf_gpu crashes with M non multiple of 32?

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
bravegag
Posts: 23
Joined: Wed Jun 19, 2013 9:51 am

dgetrf_gpu crashes with M non multiple of 32?

Post by bravegag » Mon Jan 13, 2014 10:42 am

Hello,

I'm using the latest MAGMA 1.4.1 and I noticed that for all examples in testing_dgetrf_gpu M is multiple of 32 i.e. the matrix size is set to LDDAxN where LDDA is ((M + 31) / 32)*32. When I try using the function from my application with M sizes that are not multiple of 32 it crashes (no error message just segmentation fault). I here set ldda simply to M. Is this a known limitation of dgetrf? I reviewed the function documentation and could not find anywhere mentioning such restriction.

My wrapper function looks like:

Code: Select all

	/// Computes and returns the LU decomposition of d_A
	/**
	 * Computes and returns the LU decomposition of d_A
	 */
	inline void deviceDgetrf(double* d_A, size_t m, size_t n) {
		magma_int_t info;
		magma_int_t *ipiv;
		size_t min_mn = (m < n) ? m : n;
		magma_malloc_cpu((void**) &ipiv, min_mn);
		magma_int_t ldda = m;
		MAGMA_ERROR_CHECK("magma_dgetrf_gpu", magma_dgetrf_gpu(m, n, d_A, ldda, ipiv, &info));
		magma_free_cpu(ipiv);
	}
TIA,
Best regards,
Giovanni

bravegag
Posts: 23
Joined: Wed Jun 19, 2013 9:51 am

Re: dgetrf_gpu crashes with M non multiple of 32?

Post by bravegag » Mon Jan 13, 2014 10:54 am

SOLVED.

I'm sorry, my bad, the line:

Code: Select all

magma_malloc_cpu((void**) &ipiv, min_mn);
should instead be:

Code: Select all

magma_malloc_cpu((void**) &ipiv, min_mn*sizeof(magma_int_t));

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

Re: dgetrf_gpu crashes with M non multiple of 32?

Post by mgates3 » Tue Jan 14, 2014 11:58 am

There's also
magma_imalloc_cpu( &ipiv, min_mn );
which avoids both the (void**) cast and the sizeof. Similarly,

magma_smalloc_cpu( &sA, size );
magma_dmalloc_cpu( &dA, size );
magma_cmalloc_cpu( &cA, size );
magma_zmalloc_cpu( &zA, size );

for float, double, float-complex, and double-complex matrices, respectively.
-mark

bravegag
Posts: 23
Joined: Wed Jun 19, 2013 9:51 am

Re: dgetrf_gpu crashes with M non multiple of 32?

Post by bravegag » Tue Jan 21, 2014 10:42 am

Thank you mark. Very spot on. I will change my code to avoid such mistakes in the future.

Best !

Post Reply