# BLAS headers

**URL:** <https://discourse.julialang.org/t/blas-headers/3141>\
**Category:** General Usage\
**Tags:** fortran, blas\
**Created:** [April 10, 2017, 8:59am UTC](https://discourse.julialang.org/t/blas-headers/3141 "2017-04-10T08:59:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [April 10, 2017, 8:59am UTC](https://discourse.julialang.org/t/blas-headers/3141/1 "2017-04-10T08:59:46Z")

</div>

I am currently implementing a [SDPA wrapper](https://github.com/blegat/SDPA.jl). 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  
 ](https://github.com/xianyi/OpenBLAS/issues/436) 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

```julia
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 ?

---

<div class="post-metadata">

**Author:** ![tkelman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkelman/32/692_2.png) [@tkelman](https://discourse.julialang.org/u/tkelman)\
**Post date:** [April 10, 2017, 8:45pm UTC](https://discourse.julialang.org/t/blas-headers/3141/2 "2017-04-10T20:45:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [April 11, 2017, 10:45am UTC](https://discourse.julialang.org/t/blas-headers/3141/3 "2017-04-11T10:45:23Z")

</div>

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:

```julia
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

```

---

<div class="post-metadata">

**Author:** ![tkelman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkelman/32/692_2.png) [@tkelman](https://discourse.julialang.org/u/tkelman)\
**Post date:** [April 11, 2017, 2:58pm UTC](https://discourse.julialang.org/t/blas-headers/3141/4 "2017-04-11T14:58:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [April 11, 2017, 6:39pm UTC](https://discourse.julialang.org/t/blas-headers/3141/5 "2017-04-11T18:39:23Z")

</div>

Still the same error ☹

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [April 25, 2017, 3:30pm UTC](https://discourse.julialang.org/t/blas-headers/3141/6 "2017-04-25T15:30:50Z")

</div>

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 🙂
