ADD: first commit

This commit is contained in:
2024-05-16 11:01:56 +02:00
parent 934b57b1b4
commit 1295f4db59
31 changed files with 815 additions and 66838 deletions

View File

@@ -0,0 +1,113 @@
diff -bur amrex-18.07/Src/Base/AMReX_ParallelDescriptor.cpp amrex-18.07.1/Src/Base/AMReX_ParallelDescriptor.cpp
--- amrex-18.07/Src/Base/AMReX_ParallelDescriptor.cpp 2018-07-02 19:40:21
+++ amrex-18.07.1/Src/Base/AMReX_ParallelDescriptor.cpp 2023-07-19 16:50:02
@@ -1950,22 +1950,17 @@
static MPI_Datatype mine(MPI_DATATYPE_NULL);
if ( mine == MPI_DATATYPE_NULL )
{
- IntVect iv[2]; // Used to construct the data types
- MPI_Datatype types[] = {
- MPI_LB,
- MPI_INT,
- MPI_UB};
- int blocklens[] = { 1, AMREX_SPACEDIM, 1};
- MPI_Aint disp[3];
- int n = 0;
- BL_MPI_REQUIRE( MPI_Address(&iv[0], &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[0].vect, &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[1], &disp[n++]) );
- for ( int i = n-1; i >= 0; i-- )
- {
- disp[i] -= disp[0];
+ MPI_Datatype types[] = { MPI_INT };
+ int blocklens[] = { AMREX_SPACEDIM };
+ MPI_Aint disp[] = { 0 };
+ BL_MPI_REQUIRE( MPI_Type_create_struct(1, blocklens, disp, types, &mine) );
+ MPI_Aint lb, extent;
+ BL_MPI_REQUIRE( MPI_Type_get_extent(mine, &lb, &extent) );
+ if (extent != sizeof(IntVect)) {
+ MPI_Datatype tmp = mine;
+ BL_MPI_REQUIRE( MPI_Type_create_resized(tmp, 0, sizeof(IntVect), &mine) );
+ BL_MPI_REQUIRE( MPI_Type_free(&tmp) );
}
- BL_MPI_REQUIRE( MPI_Type_struct(n, blocklens, disp, types, &mine) );
BL_MPI_REQUIRE( MPI_Type_commit( &mine ) );
}
return mine;
@@ -1976,22 +1971,17 @@
static MPI_Datatype mine(MPI_DATATYPE_NULL);
if ( mine == MPI_DATATYPE_NULL )
{
- IndexType iv[2]; // Used to construct the data types
- MPI_Datatype types[] = {
- MPI_LB,
- MPI_UNSIGNED,
- MPI_UB};
- int blocklens[] = { 1, 1, 1};
- MPI_Aint disp[3];
- int n = 0;
- BL_MPI_REQUIRE( MPI_Address(&iv[0], &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[0].itype, &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[1], &disp[n++]) );
- for ( int i = n-1; i >= 0; i-- )
- {
- disp[i] -= disp[0];
+ MPI_Datatype types[] = { MPI_UNSIGNED };
+ int blocklens[] = { 1 };
+ MPI_Aint disp[] = { 0 };
+ BL_MPI_REQUIRE( MPI_Type_create_struct(1, blocklens, disp, types, &mine) );
+ MPI_Aint lb, extent;
+ BL_MPI_REQUIRE( MPI_Type_get_extent(mine, &lb, &extent) );
+ if (extent != sizeof(IndexType)) {
+ MPI_Datatype tmp = mine;
+ BL_MPI_REQUIRE( MPI_Type_create_resized(tmp, 0, sizeof(IndexType), &mine) );
+ BL_MPI_REQUIRE( MPI_Type_free(&tmp) );
}
- BL_MPI_REQUIRE( MPI_Type_struct(n, blocklens, disp, types, &mine) );
BL_MPI_REQUIRE( MPI_Type_commit( &mine ) );
}
return mine;
@@ -2002,26 +1992,28 @@
static MPI_Datatype mine(MPI_DATATYPE_NULL);
if ( mine == MPI_DATATYPE_NULL )
{
- Box iv[2]; // Used to construct the data types
+ Box bx[2];
MPI_Datatype types[] = {
- MPI_LB,
Mpi_typemap<IntVect>::type(),
Mpi_typemap<IntVect>::type(),
Mpi_typemap<IndexType>::type(),
- MPI_UB};
- int blocklens[] = { 1, 1, 1, 1, 1};
- MPI_Aint disp[5];
- int n = 0;
- BL_MPI_REQUIRE( MPI_Address(&iv[0], &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[0].smallend, &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[0].bigend, &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[0].btype, &disp[n++]) );
- BL_MPI_REQUIRE( MPI_Address(&iv[1], &disp[n++]) );
- for ( int i = n-1; i >= 0; i-- )
- {
- disp[i] -= disp[0];
+ };
+ int blocklens[] = { 1, 1, 1 };
+ MPI_Aint disp[3];
+ BL_MPI_REQUIRE( MPI_Get_address(&bx[0].smallend, &disp[0]) );
+ BL_MPI_REQUIRE( MPI_Get_address(&bx[0].bigend, &disp[1]) );
+ BL_MPI_REQUIRE( MPI_Get_address(&bx[0].btype, &disp[2]) );
+ disp[2] -= disp[0];
+ disp[1] -= disp[0];
+ disp[0] = 0;
+ BL_MPI_REQUIRE( MPI_Type_create_struct(3, blocklens, disp, types, &mine) );
+ MPI_Aint lb, extent;
+ BL_MPI_REQUIRE( MPI_Type_get_extent(mine, &lb, &extent) );
+ if (extent != sizeof(bx[0])) {
+ MPI_Datatype tmp = mine;
+ BL_MPI_REQUIRE( MPI_Type_create_resized(tmp, 0, sizeof(bx[0]), &mine) );
+ BL_MPI_REQUIRE( MPI_Type_free(&tmp) );
}
- BL_MPI_REQUIRE( MPI_Type_struct(n, blocklens, disp, types, &mine) );
BL_MPI_REQUIRE( MPI_Type_commit( &mine ) );
}
return mine;

121
packages/opal/package.py Normal file
View File

@@ -0,0 +1,121 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Opal(CMakePackage):
"""OPAL (Object Oriented Parallel Accelerator Library) is a parallel open source tool for charged-particle optics in linear accelerators and rings,
including 3D space charge. Using the MAD language with extensions, OPAL can run on a laptop as well as on the largest high performance computing systems.
OPAL is built from the ground up as a parallel application exemplifying the fact that high performance computing is the third leg of science,
complementing theory and experiment."""
homepage = "https://amas.web.psi.ch/opal/Documentation/master/OPAL_Manual.html"
url = "https://gitlab.psi.ch/OPAL/src/-/archive/OPAL-2022.1.0/src-OPAL-2022.1.0.tar.gz"
git = "https://gitlab.psi.ch/OPAL/src.git"
maintainers("germanne", "gsell")
license("GPLv3")
version('master', branch="master")
version("2022.1.0", sha256="31f6811032e9d5400169d28a8ae6c7dee2e4a803ee82e90584d31ff7a0a18d80")
variant(
"build_type",
default="Release",
description="CMake build type",
values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
)
variant("mpi", default=True, description="Enable MPI support")
variant("tests", default=True, description="Enable OPAL unit-tests")
variant("amr", default=True, description="Enable AMR solver")
variant("amr_mg_solver", default=True, description="Enable AMR multigrid solver")
variant("static", default=True, description="Enable MPI support")
variant("bandrf", default=True, description="Compile BANDRF field conversion scripts")
variant("static", default=True, description="Enable MPI support")
variant("opal_fel", default=True, description="Enable full-wave solver")
variant("saamg_solver", default=True, description="Enable SAAMG solver")
variant("python", default=True, description="Enable PyOPAL")
variant("mslang", default=True, description="Enable mslang")
variant("ippltests", default=True, description="Enable IPPL tests")
depends_on("openblas")
depends_on("boost+chrono+filesystem+iostreams+regex+serialization+system+timer")
depends_on("boost+mpi", when="+mpi")
depends_on("boost+python", when="+python")
depends_on("python@3.0", when="+python")
depends_on(
"boost+mpi+chrono+filesystem+iostreams+regex+serialization+system+timer", when="+mpi"
)
depends_on("gsl~shared")
depends_on("h5hut+mpi", when="+mpi")
depends_on("h5hut~mpi", when="~mpi")
depends_on(
"amrex@18.07 precision=double dimensions=3 +mpi~openmp+particles+pic~eb",
when="+amr+amr_mg_solver+mpi",
)
depends_on("googletest@1.10.0:", when="+tests")
depends_on("mithra@2.0", when="+opal_fel")
depends_on(
"trilinos@12.0.1: cxxstd=17 +mpi+muelu+nox+zoltan+zoltan2+isorropia gotype=long",
when="+saamg_solver",
)
depends_on(
"trilinos@12.0.1: cxxstd=17 +mpi+muelu+nox+zoltan+zoltan2+isorropia gotype=long",
when="+amr_mg_solver",
)
depends_on("parmetis@4.0.3:", when="+saamg_solver")
depends_on("parmetis@4.0.3:", when="+amr_mg_solver")
# @master
depends_on("h5hut@2.0.0rc6", when="@master")
depends_on("hdf5@1.10.11", when="@master")
depends_on("openmpi@4.1.6", when="@master+mpi")
depends_on("boost@1.84.0", when="@master+saamg_solver")
depends_on("trilinos@13.4.0:", when="@master+saamg_solver")
depends_on("trilinos@13.4.0:", when="@master+amr_mg_solver")
# @2022.1%gcc@10.4.0
depends_on("h5hut@2.0.0rc6", when="@2022.1")
depends_on("hdf5@1.10.8", when="@2022.1")
depends_on("openmpi@4.1.5", when="@2022.1+mpi")
depends_on("boost@1.82.0", when="@2022.1+saamg_solver")
depends_on("trilinos@13.4.0", when="@2022.1+saamg_solver")
depends_on("trilinos@13.4.0", when="@2022.1+amr_mg_solver")
conflicts("~amr", "+amr_mg_solver")
# AMRex version is too old for any newer Trilinos version
requires(
"^trilinos@13.4.0",
when="^amrex@18.07",
msg="AMRex version is too old for any newer Trilinos or GCC versions."
)
def cmake_args(self):
if "+mpi" in self.spec:
env["CC"] = self.spec["mpi"].mpicc
env["CXX"] = self.spec["mpi"].mpicxx
env["FC"] = self.spec["mpi"].mpifc
if "+opal_fel" in self.spec:
env["MITHRA_PREFIX"] = self.spec["mithra"].prefix
args = [
self.define_from_variant("BUILD_OPAL_UNIT_TESTS", "tests"),
self.define_from_variant("ENABLE_AMR", "amr"),
self.define_from_variant("ENABLE_AMR_MG_SOLVER", "amr_mg_solver"),
self.define_from_variant("ENABLE_BANDRF", "bandrf"),
self.define_from_variant("USE_STATIC_LIBRARIES", "static"),
self.define_from_variant("ENABLE_OPAL_FEL", "opal_fel"),
self.define_from_variant("ENABLE_SAAMG_SOLVER", "saamg_solver"),
self.define_from_variant("BUILD_OPAL_PYTHON", "python"),
self.define_from_variant("ENABLE_IPPLTESTS", "ippltests"),
self.define_from_variant("ENABLE_MSLANG", "mslang"),
]
return args