Skip to content

Commit

Permalink
add depdency on OpenBLAS32_jll, make sure to forward to LBT if LP64 B…
Browse files Browse the repository at this point in the history
…LAS library isn't available
  • Loading branch information
swyant committed Nov 21, 2024
1 parent 53314af commit 8d81bc0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@ JuLIP = "945c410c-986d-556a-acb1-167a618e0462"
LAMMPS = "ee2e13b9-eee9-4449-aafa-cfa6a2dbe14d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
ACE1 = "0.12.2"
AtomsBase = "0.3"
Distances = "0.10"
LAMMPS = "0.7.2"
NearestNeighbors = "0.4.9"
StaticArrays = "1"
Unitful = "1"
UnitfulAtomic = "1"
julia = "1.9"
ACE1 = "0.12.2"
LAMMPS = "0.7.2"

[extras]
LAMMPS_jll = "5b3ab26d-9607-527c-88ea-8fe5ba57cafe"
14 changes: 13 additions & 1 deletion src/BasisSystems/POD/lammps_pod.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

using LAMMPS
using Printf: @sprintf
using LinearAlgebra: norm
using LinearAlgebra: norm, BLAS
import OpenBLAS32_jll

# species map can differ in order from species in pod_spec
# tradeoff between RefValue for the cache vs. just using a mutable struct?
Expand All @@ -18,6 +19,9 @@ mutable struct LAMMPS_POD <: BasisSystem
end

function LAMMPS_POD(param_file::String, lammps_species::Vector{Symbol}; parse_param_file=false)
# probably not the best location
initialize_blas()

lmp = initialize_pod_lammps(param_file,lammps_species)
num_perelem_ld = get_num_perelem_ld(lmp,lammps_species)
if parse_param_file
Expand All @@ -36,6 +40,14 @@ function LBasisPotential(lmp_pod::LAMMPS_POD, coeff_fname::String)
LBasisPotential(coeffs,zeros(1),lmp_pod)
end

# Same as https://github.com/jump-dev/Ipopt.jl/blob/ffa138dea93d994442b3aa3824688a70c598bacf/src/Ipopt.jl#L15C1-L19C8
function initialize_blas()
config = LinearAlgebra.BLAS.lbt_get_config()
if !any(lib -> lib.interface == :lp64, config.loaded_libs)
LinearAlgebra.BLAS.lbt_forward(OpenBLAS32_jll.libopenblas_path)
end
end

function initialize_pod_lammps(param_file::String, lammps_species::Vector{Symbol})
num_types = length(lammps_species)
atomtype_str = ""
Expand Down

0 comments on commit 8d81bc0

Please sign in to comment.