diff --git a/.github/workflows/ci-jll.yml b/.github/workflows/ci-jll.yml new file mode 100644 index 0000000..489f408 --- /dev/null +++ b/.github/workflows/ci-jll.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 936ebb0..1db9161 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: version: - '1.9' os: - - ubuntu-22.04 + - ubuntu-latest arch: - x64 steps: diff --git a/.gitignore b/.gitignore index 54794fb..3308b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/deps/build.jl b/deps/build.jl index 4f70456..fea7252 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -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) @@ -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) diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..301e4a1 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,3 @@ +*.vtu +*.pvtu +*.visit \ No newline at end of file diff --git a/test/example_1.jl b/test/example_1.jl index bd5d326..2807337 100644 --- a/test/example_1.jl +++ b/test/example_1.jl @@ -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() diff --git a/test/example_2.jl b/test/example_2.jl index d31cc88..b6cb3d5 100644 --- a/test/example_2.jl +++ b/test/example_2.jl @@ -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() diff --git a/test/example_3.jl b/test/example_3.jl index 2a9b9cd..d561a2c 100644 --- a/test/example_3.jl +++ b/test/example_3.jl @@ -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) diff --git a/test/example_lnodes_2d+1d.jl b/test/example_lnodes_2d+1d.jl index 2331b70..1a1b532 100644 --- a/test/example_lnodes_2d+1d.jl +++ b/test/example_lnodes_2d+1d.jl @@ -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) diff --git a/test/example_lnodes_2d.jl b/test/example_lnodes_2d.jl index 151de3e..52854f4 100644 --- a/test/example_lnodes_2d.jl +++ b/test/example_lnodes_2d.jl @@ -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) diff --git a/test/example_lnodes_3d.jl b/test/example_lnodes_3d.jl index 72d6085..d9b947a 100644 --- a/test/example_lnodes_3d.jl +++ b/test/example_lnodes_3d.jl @@ -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) diff --git a/test/runtests.jl b/test/runtests.jl index 3e4622c..aa2aa7d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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() @@ -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 diff --git a/test/test_p4est_bindings.jl b/test/test_p4est_bindings.jl index 379804a..30963c1 100644 --- a/test/test_p4est_bindings.jl +++ b/test/test_p4est_bindings.jl @@ -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) diff --git a/test/test_p8est_bindings.jl b/test/test_p8est_bindings.jl index 749aca8..31aae6e 100644 --- a/test/test_p8est_bindings.jl +++ b/test/test_p8est_bindings.jl @@ -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) diff --git a/test/test_sc_bindings.jl b/test/test_sc_bindings.jl index 8c287a3..c16a957 100644 --- a/test/test_sc_bindings.jl +++ b/test/test_sc_bindings.jl @@ -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)