<div dir="auto">You are missing a call to DMSetFromOptions</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 20, 2023, 19:20 Ramoni Z. Sedano Azevedo <<a href="mailto:ramoni.zsedano@gmail.com">ramoni.zsedano@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks for the tip. Using dm_mat_type and dm_vec_type the code runs.</div><div>./${executable} \<br> -A_dm_mat_type aijcusparse \<br> -P_dm_mat_type aijcusparse \<br> -dm_vec_type cuda \<br> -use_gpu_aware_mpi 0 \<br> -em_ksp_monitor_true_residual \<br> -em_ksp_type bcgs \<br> -em_pc_type bjacobi \<br> -em_sub_pc_type ilu \<br> -em_sub_pc_factor_levels 3 \<br> -em_sub_pc_factor_fill 6 \<br> < ./Parameters.inp \<br></div><div><br></div><div>But at the end the message appears:<div>WARNING! There are options you set that were not used!<br>WARNING! could be spelling mistake, etc!<br>There are 3 unused database options. They are:<br>Option left: name:-A_dm_mat_type value: aijcusparse<br>Option left: name:-dm_vec_type value: cuda<br>Option left: name:-P_dm_mat_type value: aijcusparse<br></div><div><br></div><div>Using nvprof does not include kernels, only API use.<br></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Ramoni Z. S. Azevedo</div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em qua., 20 de set. de 2023 às 12:31, Junchao Zhang <<a href="mailto:junchao.zhang@gmail.com" target="_blank" rel="noreferrer">junchao.zhang@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Try to also add <i>-dm_mat_type aijcusparse -dm_vec_type cuda</i></div><div><i><br clear="all"></i><div><div dir="ltr" class="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 20, 2023 at 10:21 AM Ramoni Z. Sedano Azevedo <<a href="mailto:ramoni.zsedano@gmail.com" target="_blank" rel="noreferrer">ramoni.zsedano@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Hey!<br><br>I am using PETSc in a Fortran code and we use MPI parallelization. We would like to use GPU parallelization, but we are encountering an error.<br></div><div><br></div><div>PETSc is configured as follows:<br></div><div>#!/bin/bash<br>./configure \<br> --prefix=${PWD}/installdir \<br> --with-fortran \<br> --with-fortran-kernels=true \<br> --with-cuda \<br> --download-fblaslapack \<br> --with-scalar-type=complex \<br> --with-precision=double \<br> --with-debugging=yes \<br> --with-x=0 \<br> --with-gnu-compilers=1 \<br> --with-cc=mpicc \<br> --with-cxx=mpicxx \<br> --with-fc=mpif90 \<br> --with-make-exec=make<br></div><div><br></div><div>Within my code, matrices and vectors are allocated with the following commands:<br></div><div>PetscCallA( DMDACreate3d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_BOX, l+1, m+1, nzn, PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, i3, i1, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, da, ierr) )<br><br>PetscCallA( DMSetUp(da,ierr) )<br><br>PetscCallA( DMCreateGlobalVector(da,b,ierr) )<br>PetscCallA( VecDuplicate(b,xsol,ierr) )<br>PetscCallA( VecDuplicate(b,src,ierr) )<br>PetscCallA( VecDuplicate(b,rhoxyz,ierr) )<br><br>PetscCallA( DMCreateLocalVector(da,localx,ierr) )<br>PetscCallA( VecDuplicate(localx,localb,ierr) )<br>PetscCallA( VecDuplicate(localx,localsrc,ierr) )<br>PetscCallA( VecDuplicate(localx,lrhoxyz,ierr) )<br><br>PetscCallA( VecGetLocalSize(xsol,mloc,ierr) )<br><br>ngrow=3*(l+1)*(m+1)*nzn<br> <br>PetscCallA( MatCreate(PETSC_COMM_WORLD,A,ierr) )<br>PetscCallA( MatSetOptionsPrefix(A,'A_',ierr) )<br>PetscCallA( MatSetSizes(A,mloc,mloc,ngrow,ngrow,ierr) )<br>PetscCallA( MatSetFromOptions(A,ierr) )<br>PetscCallA( MatSeqAIJSetPreallocation(A,i15,PETSC_NULL_INTEGER,ierr) )<br>PetscCallA( MatSeqBAIJSetPreallocation(A, i3, i15, PETSC_NULL_INTEGER, ierr) )<br><br>PetscCallA( MatMPIAIJSetPreallocation(A, i15, PETSC_NULL_INTEGER, i15, PETSC_NULL_INTEGER, ierr) )<br><br>PetscCallA( MatMPIBAIJSetPreallocation(A, i3, i15, PETSC_NULL_INTEGER, i15, PETSC_NULL_INTEGER, ierr) )<br><br>PetscCallA( MatCreate(PETSC_COMM_WORLD, P, ierr) )<br>PetscCallA( MatSetOptionsPrefix(P, 'P_', ierr) )<br>PetscCallA( MatSetSizes(P, mloc, mloc, ngrow, ngrow, ierr) )<br>PetscCallA( MatSetFromOptions(P, ierr) )<br>PetscCallA( MatSeqAIJSetPreallocation(P, i15, PETSC_NULL_INTEGER, ierr) )<br>PetscCallA( MatSeqBAIJSetPreallocation(P, i3, i15, PETSC_NULL_INTEGER, ierr) )<br><br>PetscCallA( MatMPIAIJSetPreallocation(P, i15, PETSC_NULL_INTEGER, i15, PETSC_NULL_INTEGER, ierr) )<br>PetscCallA( MatMPIBAIJSetPreallocation(P, i3, i15, PETSC_NULL_INTEGER, i15, PETSC_NULL_INTEGER, ierr) )<br><br>PetscCallA( DMDAGetInfo(da, PETSC_NULL_INTEGER, mx, my, mz, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER, PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,ierr) )<br>PetscCallA( DMDAGetCorners(da,xs,ys,zs,xm,ym,zm,ierr) )<br>PetscCallA( DMDAGetGhostCorners(da,gxs,gys,gzs,gxm,gym,gzm,ierr) )<br></div><div><br></div><div>PetscCallA( DMLocalToGlobal(da,localsrc,INSERT_VALUES,src,ierr) )<br>PetscCallA( DMGlobalToLocalBegin(da, src, INSERT_VALUES, localsrc, ierr) )<br>PetscCallA( DMGlobalToLocalEnd(da,src,INSERT_VALUES,localsrc,ierr) )<br></div><div>PetscCallA( DMLocalToGlobal(da,localb,INSERT_VALUES,b,ierr) )<br></div><div><br></div><div>When calling the solver function<br></div><div>PetscCallA( KSPSolve(ksp,b,xsol,ierr) )<br></div>the following error occurs:<br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><pre lang="plaintext"><span id="m_-3139188225087646016m_3951905194757427436m_1581707592154404960gmail-LC1" lang="plaintext">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</span>
<span id="m_-3139188225087646016m_3951905194757427436m_1581707592154404960gmail-LC2" lang="plaintext">[0]PETSC ERROR: Invalid argument</span>
<span id="m_-3139188225087646016m_3951905194757427436m_1581707592154404960gmail-LC3" lang="plaintext">[0]PETSC ERROR: Object (seq) is not seqcuda or mpicuda</span>
<span id="m_-3139188225087646016m_3951905194757427436m_1581707592154404960gmail-LC4" lang="plaintext">[0]PETSC ERROR: WARNING! There are option(s) set that were not used! Could be the program crashed before they were used or a spelling mistake, etc!</span>
<span id="m_-3139188225087646016m_3951905194757427436m_1581707592154404960gmail-LC5" lang="plaintext">[0]PETSC ERROR: Option left: name:-vec_type value: cuda</span>
<span id="m_-3139188225087646016m_3951905194757427436m_1581707592154404960gmail-LC6" lang="plaintext">[0]PETSC ERROR: See <a href="https://petsc.org/release/faq/" target="_blank" rel="noreferrer">https://petsc.org/release/faq/</a> for trouble shooting.</span>
<span id="m_-3139188225087646016m_3951905194757427436m_1581707592154404960gmail-LC7" lang="plaintext">[0]PETSC ERROR: Petsc Release Version 3.18.4, unknown </span>
</pre></div><div>The code is executed with the following flags:<br></div><div>./${executable} \<br> -A_mat_type aijcusparse \<br> -P_mat_type aijcusparse \<br> -vec_type cuda \<br> -use_gpu_aware_mpi 0 \<br> -em_ksp_monitor_true_residual \<br> -em_ksp_type bcgs \<br> -em_pc_type bjacobi \<br> -em_sub_pc_type ilu \<br> -em_sub_pc_factor_levels 3 \<br> -em_sub_pc_factor_fill 6 \<br> < ./Parameters.inp \<br></div><div><br></div><div>I've already tested using mpiaijcusparse for matrix and mpicuda for vector and the error continues.<br><br>Would anyone have an idea what I might be doing wrong?<br><br>Sincerely,</div><div dir="ltr">Ramoni Z. S. Azevedo</div><div dir="ltr"><br></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>