我正在WSL中使用Intel Fortran编译器,其安装目录为/opt/intel
。我想使用稀疏的BLAS函数。 link to intel's documentation of the libaray。
这是相关代码的一部分。
double complex,allocatable :: H(:,:),Hvert(:,Hstar(:,:)
allocate(H(dimH,dimH),Hvert(dimH,Hstar(dimH,dimH))
! initialization of Hstar
info = mkl_sparse_z_create_coo(Hstar,SPARSE_INDEX_BASE_ONE,m**L,2**L,ind(1,ind(2,Hele)
! initialization of empty matrix
ind = 0
info = mkl_sparse_z_create_coo(Hvert,1),H)
! add A and B to form the final matrix
info = mkl_sparse_z_add(SPARSE_OPERATION_NON_TRANSPOSE,Hstar,1d0,Hvert,H)
当我使用以下命令进行编译时
ifort -xHost -parallel full.f90 -o output -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_spblas -lmkl_core -liomp5 -lpthread -lm -qopenmp && ./output
即使我已经提供了库,它也会给我以下错误
source /opt/intel/bin/ifortvars.sh -arch intel64 -platform linux
source /opt/intel/bin/compilervars.sh -arch intel64 -platform linux
full.f90(146): error #6404: This name does not have a type,and must have an explicit type. [MKL_SPARSE_Z_CREATE_COO]
info = mkl_sparse_z_create_coo(Hvert,Hele)
------------^
full.f90(226): error #6404: This name does not have a type,and must have an explicit type. [MKL_SPARSE_Z_ADD]
info = mkl_sparse_z_add(SPARSE_OPERATION_NON_TRANSPOSE,H)
------------^
full.f90(240): error #6404: This name does not have a type,and must have an explicit type. [MKL_SPARSE_Z_MV]
info = mkl_sparse_z_mv(SPARSE_OPERATION_NON_TRANSPOSE,H,SPARSE_MATRIX_TYPE_HERMITIAN,psi(a,0d0,dummy)
--------------^
compilation aborted for full.f90 (code 1)
我认为这是由于我不正确地链接到相关库以及将矩阵初始化为普通可分配数组引起的。
如何使用这些功能?
我也不知道大写变量SPARSE_INDEX_BASE_ONE
是什么意思。我应该这样使用吗?