<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>   Likely you can fix the problem by adding<div class=""><br class=""></div><div class=""><div class="">#if defined(PETSC_HAVE_MKL_INTEL_ILP64)</div><div class="">  #define MKL_ILP64</div><div class="">#endif</div><div class=""><br class=""></div><div class="">before the <span style="font-family: Menlo; font-size: 17px; font-variant-ligatures: no-common-ligatures;" class="">#include <</span><span style="color: rgb(180, 36, 25); font-family: Menlo; font-size: 17px; font-variant-ligatures: no-common-ligatures;" class=""><b class="">mkl_spblas.h</b></span><span style="font-family: Menlo; font-size: 17px; font-variant-ligatures: no-common-ligatures;" class="">> in</span></div><div class=""><span style="font-family: Menlo; font-size: 17px; font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class=""><span style="font-family: Menlo; font-size: 17px; font-variant-ligatures: no-common-ligatures;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><font color="#c814c9" class="">src/mat/impls/aij/seq/aijmkl/aijmkl.c</font><font color="#2eaebb" class=""><span style="caret-color: rgb(46, 174, 187);" class="">  and </span></font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(200, 20, 201);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">src/mat/impls/baij/seq/baijmkl/baijmkl.c</span></div></span></div><div><br class=""></div><div>  Please let us know if this resolves the problem.</div><div><br class=""></div><div>  Barry<br class=""><blockquote type="cite" class=""><div class="">On Sep 25, 2022, at 12:37 AM, Bro H <<a href="mailto:broheimhelldawg29@gmail.com" class="">broheimhelldawg29@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Barry, thank you for answering. I did some further testing. My MKL<br class="">version is 20220002 as detected by PETSc. I tried to compile one of<br class="">the examples distributed with MKL<br class="">(${MKLROOT}/latest/examples/examples_core_c.tgz/c/sparse_blas/source/sparse_csr.c)<br class="">that contains calls to mkl_sparse_d_mv function from Sparse BLAS,<br class="">among others. It compiled and ran without errors with 64-bit indices.<br class=""><br class="">I used the following command to compile this example on Debian 11:<br class=""><br class="">gcc `mkl_link_tool --quiet -c gnu_c -o gomp -i ilp64 -opts`<br class="">sparse_csr.c `mkl_link_tool --quiet -c gnu_c -o gomp -i ilp64 -libs`<br class=""><br class="">mkl_link_tool is bundled with MKL. It returns:<br class=""><br class="">`mkl_link_tool --quiet -c gnu_c -o gomp -i ilp64 -opts` = -DMKL_ILP64<br class="">-m64  -I"${MKLROOT}/include"<br class=""><br class="">`mkl_link_tool --quiet -c gnu_c -o gomp -i ilp64 -opts` =<br class="">-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64<br class="">-lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl<br class=""><br class="">So in theory it should work when PetscInt is 64 bits, am I right? The<br class="">only problem is with the build scripts or source code in PETSc?<br class=""><br class="">Per your suggestion, I have tried to change requires32bitint to 0 in<br class="">mkl_sparse.py and mkl_sparse_optimize.py routines. PETSc used 64-bit<br class="">indices, but configuration also set MKL to 32-bit indices, so I added<br class="">--with-64-bit-blas-indices. I then ran into "Cannot use mkl_sparse<br class="">with 64-bit BLAS/Lapack indices" error, and so I tried to change<br class="">requires32bitintblas to 0 in config/BuildSystem/config/package.py.<br class="">Configuration was successful with both PETSc and MKL set to 64-bit<br class="">indices, however, it looks like PETSc was still using 32-bit indices<br class="">during compilation of aijmkl implementation, with warnings such as:<br class=""><br class="">petsc-3.17.4/src/mat/impls/aij/seq/aijmkl/aijmkl.c:282:98: warning:<br class="">passing argument 7 of ‘mkl_sparse_d_export_csr’ from incompatible<br class="">pointer type<br class=""><br class="">Are there any other modifications required to make PETSc work with<br class="">64-bit MKL Sparse BLAS?<br class=""><br class="">On Sun, Sep 25, 2022 at 3:54 AM Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> wrote:<br class=""><blockquote type="cite" class=""><br class=""><br class="">  It is possible they recently added support for using it with 64 bit integers. You would need to through their documents to see how to get mkl_spblas.h. to use 64 bit integers and if the library for 64 bit integer has a different name that would need to be linked to.<br class=""><br class="">  You would need to remove the requires32bitint = 1 from the various config/BuildSystem/config/packages/mkl_*.py routines to get configure to accept MKL sparse with 64 bit integers.<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Sep 24, 2022, at 11:04 AM, Bro H <<a href="mailto:broheimhelldawg29@gmail.com" class="">broheimhelldawg29@gmail.com</a>> wrote:<br class=""><br class="">Hello.<br class=""><br class="">I would like to build PETSc with support for MKL Sparse BLAS, so that<br class="">I can use MATAIJMKL for improved performance, but I also need to use<br class="">64 bit indices. I'm trying to build using the following parameters:<br class=""><br class="">./configure --force --prefix="/opt/libs/petsc" --with-precision=double<br class="">--with-64-bit-indices<br class="">--with-blas-lapack-dir=/opt/intel/oneapi/mkl/latest/<br class="">--with-mkl_sparse=1 --with-mkl_sparse_optimize=1 --with-debugging=0<br class="">--with-shared-libraries=1 --with-cxx=0 --with-mpi=1 --with-hdf5=1<br class="">--with-hdf5-dir="${HDF5_ROOT}" --with-openmp=1<br class=""><br class="">Configuration fails when using --with-64-bit-indices simultaneously<br class="">with --with-mkl_sparse=1 and/or --with-mkl_sparse_optimize=1 with the<br class="">following possible errors:<br class=""><br class="">"Cannot use mkl_sparse with 64 bit integers, it is not coded for this<br class="">capability"<br class="">"Cannot use mkl_sparse_optimize with 64 bit integers, it is not coded<br class="">for this capability"<br class=""><br class="">But doesn't the latest version of MKL Sparse BLAS support 64 bit<br class="">indices? It is using MKL_INT in mkl_spblas.h.<br class=""><br class="">Is it possible to build PETSc with 64 bit indices and MKL Sparse BLAS?<br class=""></blockquote><br class=""></blockquote></div></div></blockquote></div><br class=""></div></body></html>