Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
-
ah2012
- Posts: 4
- Joined: Thu Jul 21, 2016 5:40 pm
Post
by ah2012 » Mon Sep 12, 2016 9:19 pm
Hi,
I'm trying to call magma_dpotrf or magma_dpotrf_m in a project, but I haven't been able to get the output to run without producing an error (although my code compiles without a problem). I decided to simplify the call and write a short example, but I'm still unable to run this without a segmentation fault.
Code: Select all
#include <cublas_v2.h>
#include <magma.h>
#include <magma_lapack.h>
#include <stdio.h>
void main() {
int size = 2;
int *info;
double A[4] = {2.0, 1.0, 1.0, 2.0};
magma_init();
magma_dpotrf(MagmaUpper, size, A, size, info);
for (int i = 0; i < 4; i++) {
printf("%f\n", A[i]);
}
magma_finalize();
}
I've been able to use other Magma routines successfully with the anticipated result (although I haven't tried them all). I'm relatively new to programming in C, so I apologize if there is an easy fix I'm overlooking.
I'm using Magma 2.0.2 on Ubuntu 16.04 with OpenBLAS. Thank you for your help!
-
mgates3
- Posts: 918
- Joined: Fri Jan 06, 2012 2:13 pm
Post
by mgates3 » Tue Sep 13, 2016 11:49 am
Declare info to be an int, instead of int*, and pass a pointer to it in dpotrf. Currently, you are passing a dangling pointer that points to nothing.
Code: Select all
int info = 0;
...
magma_dpotrf(MagmaUpper, size, A, size, &info);
if (info != 0) {
// handle error, e.g., not positive definite
}
Other recommendations:
I recommend using magma_v2.h instead of magma.h.
If you aren't calling blasf77_* or lapackf77_*, you don't need magma_lapack.h.
-mark