BLAS headers

fortran
blas

#1

I am currently implementing a SDPA wrapper. I use the BLAS/LAPACK libraries used by Julia which can be obtained by Libdl.dlpath(BLAS.libblas). The value is typically /usr/lib/julia/libopenblas64_.so. As Julia adds a 64_ suffix
to the BLAS calls, I need to redefine BLAS functions when compiling the library using, e.g. -Ddgemm_=dgemm_64_ when compiling SDPA.
However, for some fortran code, redefinining dgemm to dgemm_64 gives me

Error: Function ‘alpuip21k’ at (1) has no IMPLICIT type
dmumps_part6.F:3575:14:

      &        root%SCHUR_POINTER(1),

I have never done any fortran but it seems to me that the fact that gfortran is not able to infer this type may be due to the fact that it does not know any external function dgemm_64. Therefore, it seems to me that this could be fixed by using an header with the suffixed functions. Is Julia shipped with the openblas header in addition to the openblas library ? Or would you have another idea to fix this ?


#2

Are you also changing all of the expected integer sizes in the code you’re compiling?


#3

Thanks for you quick response. How could I change the expected integer sizes ?
In SCS.jl, they do -DCOPYAMATRIX -DDLONG -DLAPACK_LIB_FOUND -DCTRLC=1 -DBLAS64 -DBLASSUFFIX=_64_. I have seen that BLASSUFFIX and LAPACK_LIB_FOUND are SCS specific and when I add the other options, I still get the same errors.
In CSDP.jl, @EQt does -march=x86-64 -m64 -Dinteger=long. If I add the first two options, I still get the same errors and with the third options, I get even more errors such as:

mumps_static_mapping.F:294:34:

      &     (cv_keep(79).EQ.5).OR.(cv_keep(79).EQ.7)
                                  1
Error: Function ‘cv_keep’ at (1) has no IMPLICIT type

#4

Can maybe try -fdefault-integer-8 if it’s entirely Fortran code you’re dealing with?


#5

Still the same error :frowning:


#6

As a workaround, when Base.BLAS.vendor() is :openblas64 I do not use Julia’s lapack libraries and look for system library. That is not ideal anyone if anyone finds a way to make SDPA works with julia libraries in that case, please let me know :slight_smile: