Failing to use openacc inside a magma code

33 views
Skip to first unread message

Soham Ghosh

unread,
Mar 15, 2022, 10:32:22 PM3/15/22
to MAGMA User
Hi everyone, 

I am trying to use openacc to zero out the lower triangle of a matrix (dA). I have allocated memory on device using magma. But, I cannot get openACC to operate on it. My attempt looks like this:
-------------------------------------------------------------------------------------
real        :: A(ldda,n)

magma_devptr_t    :: dA

...

info = magmaf_dmalloc(dA, size(A)) 
...
<<<use some magma gpu routines on dA>>>
...   

    !$acc parallel loop collapse(2) deviceptr(dA)

    do i = 2, ldda

      do j = 1, n

        k = MOD(j, i-1) + 1 

        dA(i,k) = 0.0D0

      end do ! j 

    end do ! i 

    !$acc end parallel

....

<<< use the upper triangular matrix dA in other magma gpu routines>>>>

------------------------------------------------------------------------

The compiler tells me that dA(i,k) = 0.0D0 is an unclassified statement. How do I mke openacc aware of the array that is already on device?

I have tried the !$acc data present (dA) as well.


Thanks for your time looking into this,

Soham.

Ahmad Abdelfattah

unread,
Mar 16, 2022, 12:14:13 AM3/16/22
to Soham Ghosh, MAGMA User
Hi, 

I am not familiar with OpenACC, but you can use magmablas_dlaset instead to zero out the lower triangular part of dA. 

Thanks,
Ahmad

--
You received this message because you are subscribed to the Google Groups "MAGMA User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to magma-user+...@icl.utk.edu.
To view this discussion on the web visit https://groups.google.com/a/icl.utk.edu/d/msgid/magma-user/21651ee5-16f4-4ec9-9985-097997345aa2n%40icl.utk.edu.

Soham Ghosh

unread,
Mar 16, 2022, 3:54:00 PM3/16/22
to MAGMA User, ah...@icl.utk.edu, Soham Ghosh
Hi Ahmad, 
Thanks!

Soham Ghosh

unread,
Mar 17, 2022, 7:22:28 PM3/17/22
to MAGMA User, Soham Ghosh, ah...@icl.utk.edu
Hello, 
Sorry to bother you all on this again, but I tested magmablas_dlaset() and could not find an easy way to leave the diagonal elements alone. Is there a way to set the lower triangle (not including the diagonal elements)?. I can do it by adding an extra 1st column or an extra 1st row before magmablas_dlaset() acts on it, but thats additional complication and a speed bottleneck.

Thanks, 
Soham. 

Mark Gates

unread,
Mar 18, 2022, 10:56:53 AM3/18/22
to Soham Ghosh, MAGMA User
On Thu, Mar 17, 2022 at 7:22 PM Soham Ghosh <soha...@lbl.gov> wrote:
Hello, 
Sorry to bother you all on this again, but I tested magmablas_dlaset() and could not find an easy way to leave the diagonal elements alone. Is there a way to set the lower triangle (not including the diagonal elements)?

Shift A by 1 row:
laset( lower, m-1, n, alpha_offdiag, beta_diag, &A[ 1 ], lda )
Probably with alpha_offdiag = beta_diag. In this case, the diagonal of A[ 1:m-1, 0:n-1 ] is the sub-diagonal of A[ 0:m-1, 0:n-1 ].

Mark

Anis

unread,
Jun 5, 2022, 11:32:08 PM6/5/22
to MAGMA User, mga...@icl.utk.edu, MAGMA User, Soham Ghosh
Hi  everyone ,
I am facing the same problem as you using MAGMA in openacc. Did you manage to get a solution.
My code looks like this:
----------------------------------------------------------------
real        :: A(n,n)
magma_devptr_t    : queue
.....
 !$acc parallel loop copy(A(:,:))
$acc host_data use_device(A)
       call magmablasf_dtranspose_inplace( n, A, n, queue )
!$acc end host_data
----------------------------------------------------------------
I have mismatch erro for A. i use nvfortran compiler

Thanks,
Anis
Reply all
Reply to author
Forward
0 new messages