Code Monkey home page Code Monkey logo

Comments (15)

TeroFrondelius avatar TeroFrondelius commented on September 27, 2024

Can you use Blas/Lapack from LinearAlgebra, I mean the one that comes with julia?

from gmsh.jl.

ahojukka5 avatar ahojukka5 commented on September 27, 2024

Good question. I don't know. I guess I managed to handle BLAS dependency by adding OpenBLAS to dependency list, but I think we also need LAPACK. I think the question is that is there BLAS and/or LAPACK development files available inside the cross-compile environment?

from gmsh.jl.

krometis avatar krometis commented on September 27, 2024

Do you have any pointers about how to tweak the build to point to LAPACK? When I build Gmsh this error message is in the logs:

$ grep -i blas -A1 ~/.julia/packages/Gmsh/eZVOZ/deps/usr/logs/gmsh.log
-- Could NOT find BLAS (missing: BLAS_LIBRARIES) 
CMake Warning at CMakeLists.txt:495 (message):
  Could not find Blas or Lapack: most meshing algorithms will not be
  functional

and presumably as a result, when I try to generate a mesh, I get

Error   : Singular value decomposition requires LAPACK

and then a segfault. I'm building on a cluster, so my linear algebra libraries are installed in non-standard locations. Do you have pointers about how I can point Gmsh/BinaryBuilder to the right directories/libraries? I see the cmake command here but I can't figure out where that file is so I can edit it.

from gmsh.jl.

ahojukka5 avatar ahojukka5 commented on September 27, 2024

I think the right way to go is to use binary dependencies, just like with OpenBLAS

from gmsh.jl.

TeroFrondelius avatar TeroFrondelius commented on September 27, 2024

Here is an example how to use julia Lapack: https://github.com/TeroFrondelius/umat_binaries_builder/blob/242ebd1c3f1d04bc2780d0d0b684c23a46ea1008/build_tarballs.jl#L76

from gmsh.jl.

krometis avatar krometis commented on September 27, 2024

I think what I'm struggling with is how to edit build_tarballs.jl. That file is part of GmshBuilder, but it's not clear to me how that gets called when I run ]add Gmsh (or ]build Gmsh). It doesn't appear to be anywhere in my .julia directory, for example:

$ find ~/.julia -name build_tarballs.jl
$

The only mention of GmshBuilder is here, which appears to only be used to download the source code:

$ grep -R -i GmshBuilder ~/.julia
/home/jkrometi/.julia/packages/Gmsh/eZVOZ/deps/build.jl:bin_prefix = "https://github.com/ahojukka5/GmshBuilder/releases/download/v4.4.1"

I can of course clone the GmshBuilder repo and edit build_tarballs.jl. But how do I get that local version to be used when I run ]add Gmsh? I apologize if this is a silly question but what Julia is doing under the hood here is very opaque to me.

(In addition, it's maybe worth mentioning that I have also Gmsh installed separately. So if I can just point Gmsh.jl to that installation, I'm also happy to do that.)

from gmsh.jl.

TeroFrondelius avatar TeroFrondelius commented on September 27, 2024

The package downloads pre-build binaries from here: https://github.com/ahojukka5/GmshBuilder/releases/tag/v4.4.1. The changes in building binaries should be made there. Download the tar file and check the structure. Use ln to link missing libraries.

from gmsh.jl.

krometis avatar krometis commented on September 27, 2024

Oh I see now. It's just downloading prebuilt binaries and the Linux version is missing BLAS/LAPACK:

$ wget https://github.com/ahojukka5/GmshBuilder/releases/download/v4.4.1/gmsh.v4.4.1.x86_64-linux-gnu.tar.gz
$ mkdir gmsh.v4.4.1.x86_64-linux-gnu
$ tar xzf gmsh.v4.4.1.x86_64-linux-gnu.tar.gz -C gmsh.v4.4.1.x86_64-linux-gnu/
$ egrep -i 'blas|lapack' gmsh.v4.4.1.x86_64-linux-gnu/logs/gmsh.log 
-- Could NOT find BLAS (missing: BLAS_LIBRARIES) 
  Could not find Blas or Lapack: most meshing algorithms will not be

By contrast, the Mac version has BLAS/LAPACK:

$ wget https://github.com/ahojukka5/GmshBuilder/releases/download/v4.4.1/gmsh.v4.4.1.x86_64-apple-darwin14.tar.gz
$ mkdir gmsh.v4.4.1.x86_64-apple-darwin14
$ tar xzf gmsh.v4.4.1.x86_64-apple-darwin14.tar.gz -C gmsh.v4.4.1.x86_64-apple-darwin14
$ egrep -i 'blas|lapack' gmsh.v4.4.1.x86_64-apple-darwin14/logs/gmsh.log 
-- Found Blas[veclib]
-- Found Lapack[veclib]
--  * Build options: 64Bit Blas[veclib] Dlopen Lapack[veclib] Mesh TetGen/BR

I have been working with a colleague on some code using Gmsh and it was working for him and not for me. I assumed this was because he was on a desktop and I was on a cluster. But it turns out to be because he's on a Mac and I'm on Linux. I guess I need to edit build.jl to point it to the source tarball instead or maybe bypass all of this and just point to my external installation.

from gmsh.jl.

krometis avatar krometis commented on September 27, 2024

Okay it appears to be working now after the following steps (here $gmshdir is where I wanted gmsh ultimately installed):

  1. Install gmsh in a separate location. This was straightforward - I made sure that OpenBLAS was in my library path and then:
wget wget http://gmsh.info/src/gmsh-4.4.1-source.tgz #download
tar xzf v4.4.1.tar.gz #untar
cd gmsh-4.4.1-source
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$gmshdir -DDEFAULT=0 -DENABLE_BUILD_SHARED=1 -DENABLE_MESH=1 ..
  1. Symlink lib to lib64 since my installation created lib64 but Gmsh.jl looks for lib:
ln -s 'lib64' $gmshdir/lib
  1. Remove the Gmsh.jl gmsh installation and symlink to my external gmsh installation (~/.julia/packages/Gmsh/eZVOZ is where Gmsh.jl was installed in my case):
cd ~/.julia/packages/Gmsh/eZVOZ/deps
rm -rf usr
ln -s "$gmshdir" usr

I could have not removed all of deps/usr and instead just symlinked the gmsh library itself but it just seemed cleaner/safer to symlink the whole directory.

Thank you both for your help with this!

from gmsh.jl.

ahojukka5 avatar ahojukka5 commented on September 27, 2024

Hmm, so you didn't use a cross-compiling environment used in BinaryBuilder to make the binary at all?

from gmsh.jl.

krometis avatar krometis commented on September 27, 2024

No, I didn't - I just made sure that Julia and gmsh were built with the same compiler and other dependencies and it seemed to work, at least in initial testing. Is not using BinaryBuilder going to come back to bite me at some point?
(Note: Not using BinaryBuilder was not a strategic choice - I just haven't used it before and figured I could build gmsh pretty easily on my own, so I just went ahead with that.)

from gmsh.jl.

ahojukka5 avatar ahojukka5 commented on September 27, 2024

Likely not, but it doesn't generalize. Thus we cannot use it to create binaries that should work for all. If we generate the binaries using BinaryBuilder, we can then distribute the binaries and everyone can easily install Gmsh.jl.

from gmsh.jl.

stevengj avatar stevengj commented on September 27, 2024

It looks like this is still an issue with the JLL binary? My students tell me that the Mac version has LAPACK but the Linux version gives a "LU factorization and substitution requires LAPACK" error.

I don't see any mention of a LAPACK or OpenBLAS dependency in the Yggdrasil build script, it seems like this needs to be added?

Should this issue be re-opened?

from gmsh.jl.

fredrikekre avatar fredrikekre commented on September 27, 2024

Did they run on master? There haven't been a release of thsi package in a while. Edit: JuliaRegistries/General#63264

from gmsh.jl.

stevengj avatar stevengj commented on September 27, 2024

Thanks! Yes, updating to the latest version fixed the problem.

from gmsh.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.