help with dpotrf

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)

help with dpotrf

Postby ah2012 » Mon Sep 12, 2016 9:19 pm


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_dpotrf(MagmaUpper, size, A, size, info);

        for (int i = 0; i < 4; i++) {
                printf("%f\n", A[i]);

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!
Posts: 4
Joined: Thu Jul 21, 2016 5:40 pm

Re: help with dpotrf

Postby 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.

Posts: 791
Joined: Fri Jan 06, 2012 2:13 pm

Return to User discussion

Who is online

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