Skip to content

Use local dynamic libraries rather than jll binaries#235

Merged
boriskaus merged 8 commits into
mainfrom
bk/local-dylib
Apr 22, 2026
Merged

Use local dynamic libraries rather than jll binaries#235
boriskaus merged 8 commits into
mainfrom
bk/local-dylib

Conversation

@boriskaus
Copy link
Copy Markdown
Collaborator

By default, we use PETSc_jll binaries.
In some cases, you may instead want to use your own, locally, compiled version of PETSc, for example because you configured it with GPU support, or because you want additional external packages that we don't provide.

With this PR you can configure them as:

export JULIA_PETSC_LIBRARY=/path/to/libpetsc.so

if your library is compiled with 64bit indices and for Float64, this will do the job.
For other choices, you should also provide:

export JULIA_PETSC_SCALAR=Float64        # Float32 | ComplexFloat64 | ComplexFloat32
export JULIA_PETSC_INT=Int64             # Int32

We now have 2 options:

# Option 1: point directly to your library (sets libs AND skips JLL)
export JULIA_PETSC_LIBRARY=/path/to/libpetsc.so

# Option 2: skip JLL, then use set_petsclib() in your script
export JULIA_PETSC_SKIP_JLL=1
With option 2, getlib() won't work (no libs registered), but set_petsclib("/path/to/libpetsc.so") gives you full control over scalar/int types.
export JULIA_PETSC_LIBRARY=/path/to/libpetsc.so
export JULIA_PETSC_SCALAR=Float64        # Float32 | ComplexFloat64 | ComplexFloat32
export JULIA_PETSC_INT=Int64             # Int32
@vchuravy
Copy link
Copy Markdown
Member

I always find environment variables a bit fragile. For LAMMPS.jl I provided a solution using preferences.

https://github.com/cesmix-mit/LAMMPS.jl/blob/56ddcb925fc8fff537052c2897d457d434925721/src/LAMMPS.jl#L117-L142

@boriskaus
Copy link
Copy Markdown
Collaborator Author

thanks! Trying that instead now.

@boriskaus boriskaus merged commit 740cf9f into main Apr 22, 2026
6 checks passed
@boriskaus boriskaus deleted the bk/local-dylib branch April 22, 2026 07:10
@boriskaus boriskaus restored the bk/local-dylib branch April 22, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants