Skip to content

Commit

Permalink
Merge pull request #23 from gridap/windows-path
Browse files Browse the repository at this point in the history
Library pathfinding in Windows
  • Loading branch information
JordiManyer authored May 14, 2024
2 parents ac20d26 + a3692cc commit 908cfce
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 16 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci-jll.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI
on: [push, pull_request]
jobs:
test-artifacts:
name: Artifact tests ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.9'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
version:
- '1.9'
os:
- ubuntu-22.04
- ubuntu-latest
arch:
- x64
steps:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
*.jl.mem
.DS_Store
/Manifest.toml
/LocalPreferences.toml
/deps/build.log
/deps/deps.jl
/dev/
/docs/build/
/docs/site/
/gen/Manifest.toml

/gen/LocalPreferences.toml
14 changes: 11 additions & 3 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ if isdir(P4EST_DIR)
end

if (cmp(P4EST_LIB,"") == 0)
# Check P4EST_LIB (.../libp4est.so file) exists
P4EST_LIB = string(Libdl.find_library(P4EST_LIB_NAME,[P4EST_LIB_DIR,P4EST_ROOT_DIR]),".",Libdl.dlext)
# Check P4EST_LIB (.../libp4est.so file) exists
if P4EST_ARTIFACT
P4EST_LIB = P4est_jll.get_libp4est_path()
else
P4EST_LIB = string(Libdl.find_library(P4EST_LIB_NAME,[P4EST_LIB_DIR,P4EST_ROOT_DIR]),".",Libdl.dlext)
end
end

if isfile(P4EST_LIB)
Expand All @@ -61,7 +65,11 @@ if isdir(P4EST_DIR)
else
if (cmp(P4EST_LIB,"") == 0)
# Check P4EST_LIB (.../libp4est.so file) exists
P4EST_LIB = string(Libdl.find_library(P4EST_LIB_NAME,[P4EST_LIB_DIR,P4EST_ROOT_DIR]),".",Libdl.dlext)
if P4EST_ARTIFACT
P4EST_LIB = P4est_jll.get_libp4est_path()
else
P4EST_LIB = string(Libdl.find_library(P4EST_LIB_NAME,[P4EST_LIB_DIR,P4EST_ROOT_DIR]),".",Libdl.dlext)
end
end

if isfile(P4EST_LIB)
Expand Down
3 changes: 3 additions & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.vtu
*.pvtu
*.visit
2 changes: 1 addition & 1 deletion test/example_1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const search_point_fn_c = @cfunction(search_point_fn, Cint, (Ptr{p4est_t}, p4est
# Main program
#############################################################################

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD

# Create a connectivity structure for the unit square.
unitsquare_connectivity = p4est_connectivity_new_unitsquare()
Expand Down
2 changes: 1 addition & 1 deletion test/example_2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const my_refine_c = @cfunction(my_refine, Cint, (Ptr{p4est_t}, p4est_topidx_t, P
# Main program
#############################################################################

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD

# Create a connectivity structure for the unit square.
unitsquare_connectivity = p4est_connectivity_new_unitsquare()
Expand Down
2 changes: 1 addition & 1 deletion test/example_3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ end
# Main program
#############################################################################

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD
sc_init(mpicomm, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT)
p4est_init(C_NULL, P4est_wrapper.SC_LP_DEFAULT)

Expand Down
2 changes: 1 addition & 1 deletion test/example_lnodes_2d+1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ end
# # Main program
# #############################################################################

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD
sc_init(mpicomm, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_VERBOSE)
p4est_init(C_NULL, P4est_wrapper.SC_LP_VERBOSE)

Expand Down
2 changes: 1 addition & 1 deletion test/example_lnodes_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ end
# Main program
#############################################################################

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD
sc_init(mpicomm, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT)
p4est_init(C_NULL, P4est_wrapper.SC_LP_DEFAULT)

Expand Down
2 changes: 1 addition & 1 deletion test/example_lnodes_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ end
# Main program
#############################################################################

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD
sc_init(mpicomm, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT)
p4est_init(C_NULL, P4est_wrapper.SC_LP_DEFAULT)

Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Test
# Skip tests if library was not properly loaded
if P4est_wrapper.P4EST_FOUND
repodir = normpath(joinpath(@__DIR__,".."))
nprocs = min(Sys.CPU_THREADS, 2)
nprocs = P4est_wrapper.P4EST_ENABLE_MPI ? min(Sys.CPU_THREADS, 2) : 1
dir = dirname(@__FILE__)
julia = Base.julia_cmd()
mpiexec = MPI.mpiexec()
Expand All @@ -16,7 +16,7 @@ if P4est_wrapper.P4EST_FOUND
extra_args = ``
end
@testset "Test SC bindings" begin
cmd = `$mpiexec -n $nprocs $(extra_args) $(julia) --project=$repodir $(joinpath(dir, "test_sc_bindings.jl"))`
cmd = `$mpiexec -n $nprocs $(extra_args) $(julia) --project=$repodir $(joinpath(dir, "test_sc_bindings.jl"))`
@show cmd
run(cmd)
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_p4est_bindings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ end
# Definition of data structures and function callbacks
#############################################################################

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD

# Dummy callback
dummy_callback( ::Ptr{p4est_t}, which_tree::p4est_topidx_t, quadrant::Ptr{p4est_quadrant_t}) = Cint(0)
Expand Down
2 changes: 1 addition & 1 deletion test/test_p8est_bindings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end
#############################################################################
# Definition of data structures and function callbacks
#############################################################################
mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD

# Dummy callback
dummy_callback( ::Ptr{p8est_t}, which_tree::p4est_topidx_t, quadrant::Ptr{p8est_quadrant_t}) = Cint(0)
Expand Down
2 changes: 1 addition & 1 deletion test/test_sc_bindings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if !MPI.Initialized()
MPI.Init()
end

mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0)
mpicomm = MPI.COMM_WORLD

# SC library initialization
sc_init(mpicomm, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT)
Expand Down

0 comments on commit 908cfce

Please sign in to comment.