-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot find blas/lapack #112
Comments
It seems that (on my system anyways) multifario is somewhat improperly configured. The libMF references symbols from libSH, but it is not linked to it and assumes the user of the libraries links to them both. The problem this causes for Julia is that it is not linked to the libraries, it loads them dynamically, and the default behavior is to keep dynamically loaded libraries from accessing each other. So a quick fix I did was to make a single library to link all of the multifario libraries together, like the gcc command does:
Which is essentially the command used to build ComputeSphereSub (found by running make), but using This 1 library can then be used, something like this: julia> module libmultifario
using CBinding
c`-I $(pwd())/multifario-v1.0/include -L $(pwd())/multifario-v1.0 -lmultifario`
const c"FILE" = Cvoid
# headers included from ComputeSphereSub.c
c"""
#include <MFAtlas.h>
#include <MFNRegion.h>
#include <MFNVector.h>
#include <MFFortran.h>
#include <MFMultifariosMethod.h>
"""ji
end There are many warnings about functions defined in the header files that are not actually in the libraries though, but it seems that implementing the ComputeSphereSub code in Julia is possible: julia> e=libmultifario.MFCreateErrorHandler()
CBinding.Cptr{Main.libmultifario.var"c\"struct MFErrorHandlerSt\""}(0x0000000001ec49d0) At no point did I encounter an issue with BLAS/LAPACK as you mentioned though, so perhaps this alternative approach mitigates that issue for you. |
Thanks a lot for the explanations! I still have the same issue (julia 1.8 apple M1). The last line output the lapack error c"""
#include <MFFortran.h>
#include <multifarioConfig.h>
#include <MFAtlas.h>
#include <MFNRegion.h>
#include <MFNVector.h>
#include <math.h>
#include <MFFortran.h>
#include <MFMultifariosMethod.h>
"""ji
function F(n, z, m, f, data, e)
f[1]= z[1]^2 + z[2]^2 + z[3]^2 - 1.
nothing
end
function dF(n, z, m, df, data, e)
df[0+1* 0+1]= 2*z[0+1]
df[0+1* 1+1]= 2*z[1+1]
df[0+1* 2+1]= 2*z[2+1]
nothing
end
function ddF(n, z, m, ddf, data, e)
ddf[0+1*(0+3*0)+1]= 2
ddf[0+1*(1+3*0)+1]= 0
ddf[0+1*(2+3*0)+1]= 0
ddf[0+1*(0+3*1)+1]= 0
ddf[0+1*(1+3*1)+1]= 2
ddf[0+1*(2+3*1)+1]= 0
ddf[0+1*(0+3*2)+1]= 0
ddf[0+1*(1+3*2)+1]= 0
ddf[0+1*(2+3*2)+1]= 2
nothing
end
function DrawSphere( v,u,d, e)
if(u==C_NULL||v==C_NULL)
return Int32(3)
end
u[0+1] = MFNV_C(v,0,e)
u[1+1] = MFNV_C(v,1,e)
u[2+1] = MFNV_C(v,2,e)
return Int32(0)
end
e = MFCreateErrorHandler()
n = 3
k = 2
M = MFIMFCreateAlgebraicSubroutine(n, k, F, dF, ddF, C_NULL, e)
MFIMFSetProjectForDraw(M, DrawSphere, e)
u0 = [MFIMFVectorFactory(M, e) for _ = 1:2]
Omega = MFNRegionCreateHyperCube(n, 1.1, e)
u0[1] = MFIMFVectorFactory(M, e)
for j=0:n-1
MFNVSetC(u0[1], j, 0., e)
end
MFNVSetC(u0[1], 1, 1., e)
u0[2]=MFIMFVectorFactory(M, e)
for j=0:n-1
MFNVSetC(u0[2], j, 0., e)
end
MFNVSetC(u0[2], 2, 1., e)
H = MFCreateMultifariosMethod(e)
MFMultifarioSetRealParameter(H, "epsilon", .01, e)
MFMultifarioSetIntegerParameter(H, "maxCharts", 100, e)
MFMultifarioSetIntegerParameter(H, "verbose", 1, e)
MFMultifarioSetIntegerParameter(H, "page", 1, e)
MFMultifarioSetIntegerParameter(H, "dumpToPlotFile", 1, e)
MFMultifarioSetIntegerParameter(H, "dumpToCenterFile", 1, e)
MFMultifarioSetFilename(H, "SphereSub", e)
S = MFComputeAtlasMultiple(H, M, Omega, 2, u0, e) |
Well, unfortunately what you posted runs fine on my Linux system with Julia 1.8.2... Only thought I have is to just verify that your aggregate library links to some BLAS/LAPACK libraries. It might look something like this (run in a shell):
|
Hi,
I am building a wrapper for multifario.sourceforge.io/. So far, every works pretty well, I am impressed by the bindings generated by the package!
However, I have an example file from multifario that I can compile with
and it works when I run
ComputeSphereSub
I have translated the same code (from ComputeSphereSub.c) and use the same import
c"-std=c99 -Wl -I/Users/me/Downloads/work/multifario-v1.0/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/Headers/ -L/Users/me/Downloads/work/multifario-v1.0/lib -L/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/ -lgfortran -lquadmath -lm -lblas -llapack -lsh -lexpcmp -lautof2c -lauto2000 -lmf"
but when running the Julia code, I get the error
Am I missing something?
The text was updated successfully, but these errors were encountered: