From 4c111554ae47a666e619ceeaf572653d9f303428 Mon Sep 17 00:00:00 2001 From: Christoph Weber <96774182+Christoph-TU@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:46:17 +0200 Subject: Add ipm package (#40069) --- var/spack/repos/builtin/packages/ipm/package.py | 103 +++++++++++++++++++++ ...move_MPI_2COMPLEX_and_MPI_2DOUBLE_COMPLEX.patch | 37 ++++++++ 2 files changed, 140 insertions(+) create mode 100644 var/spack/repos/builtin/packages/ipm/package.py create mode 100644 var/spack/repos/builtin/packages/ipm/remove_MPI_2COMPLEX_and_MPI_2DOUBLE_COMPLEX.patch diff --git a/var/spack/repos/builtin/packages/ipm/package.py b/var/spack/repos/builtin/packages/ipm/package.py new file mode 100644 index 0000000000..0c4b94c8c4 --- /dev/null +++ b/var/spack/repos/builtin/packages/ipm/package.py @@ -0,0 +1,103 @@ +# Copyright 2013-2023 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 * +from spack.util.executable import Executable + + +class Ipm(AutotoolsPackage): + """IPM is a portable profiling infrastructure for parallel codes. + It provides a low-overhead profile of application performance + and resource utilization in a parallel program. Communication, + computation, and IO are the primary focus.""" + + homepage = "https://github.com/nerscadmin/IPM" + git = "https://github.com/nerscadmin/IPM.git" + + maintainers("Christoph-TU") + + version("master", branch="master", preferred=True) + version("2.0.6", tag="2.0.6") + + variant("papi", default=False, description="Enable PAPI") + variant("cuda", default=False, description="Enable CUDA") + variant("libunwind", default=False, description="Enable libunwind") + + variant( + "papi_multiplexing", default=False, when="+papi", description="Enable PAPI multiplexing" + ) + variant( + "coll_details", + default=False, + description="Enable detailed monitoring of collective operations (experimental)", + ) + variant("posixio", default=False, description="Enable POSIXIO") + variant("pmon", default=False, description="Enable power monitoring module") + variant("parser", default=False, description="Add dependencies for running ipm_parse") + + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") + depends_on("m4", type="build") + + depends_on("mpi") + depends_on("papi", when="+papi") + depends_on("cuda", when="+cuda") + depends_on("libunwind", when="+libunwind") + + # These are required when running the perl script ipm_parse, + # which is used to create reports from the generated xml file + depends_on("perl", type="run", when="+parser") + depends_on("ploticus", type="run", when="+parser") + + # 2COMPLEX and 2DOUBLE_COMPLEX are non-standard types and lead + # to compile errors when building with coll_details + patch("remove_MPI_2COMPLEX_and_MPI_2DOUBLE_COMPLEX.patch", when="+coll_details") + + def patch(self): + filter_file(r"#!/usr/bin/perl", "#!/usr/bin/env perl", "bin/ipm_parse") + + def setup_build_environment(self, env): + spec = self.spec + env.set("MPICC", spec["mpi"].mpicc) + env.set("MPIFC", spec["mpi"].mpifc) + env.set("MPICXX", spec["mpi"].mpicxx) + env.set("MPIF77", spec["mpi"].mpif77) + + def autoreconf(self, spec, prefix): + script = Executable(join_path(self.stage.source_path, "bootstrap.sh")) + script() + + def configure_args(self): + args = [] + spec = self.spec + if "+papi" in spec: + args.append("--with-papi={0}".format(spec["papi"].prefix)) + + if "+cuda" in spec: + args.append("--with-cudapath={0}".format(spec["cuda"].prefix)) + + if "+libunwind" in spec: + args.append("--with-libunwind={0}".format(spec["libunwind"].prefix)) + + if "+papi_multiplexing" in spec: + args.append("--enable-papi-multiplexing") + + if "+posixio" in spec: + args.append("--enable-posixio") + + if "+pmon" in spec: + args.append("--enable-pmon") + + if "+coll_details" in spec: + args.append("--enable-coll-details") + + args.extend( + [ + "CFLAGS={0}".format(self.compiler.cc_pic_flag), + "CXXFLAGS={0}".format(self.compiler.cxx_pic_flag), + ] + ) + return args diff --git a/var/spack/repos/builtin/packages/ipm/remove_MPI_2COMPLEX_and_MPI_2DOUBLE_COMPLEX.patch b/var/spack/repos/builtin/packages/ipm/remove_MPI_2COMPLEX_and_MPI_2DOUBLE_COMPLEX.patch new file mode 100644 index 0000000000..2958e95a1c --- /dev/null +++ b/var/spack/repos/builtin/packages/ipm/remove_MPI_2COMPLEX_and_MPI_2DOUBLE_COMPLEX.patch @@ -0,0 +1,37 @@ +diff --git a/include/mod_mpi.h b/include/mod_mpi.h +index 135a558..00b5382 100755 +--- a/include/mod_mpi.h ++++ b/include/mod_mpi.h +@@ -316,8 +316,6 @@ extern char* ipm_mpi_op[MAXNUM_MPI_OPS]; + #define IPM_MPI_2INTEGER 34 + #define IPM_MPI_2REAL 35 + #define IPM_MPI_2DOUBLE_PRECISION 36 +-#define IPM_MPI_2COMPLEX 37 +-#define IPM_MPI_2DOUBLE_COMPLEX 38 + + extern char* ipm_mpi_type[MAXNUM_MPI_TYPES]; + +@@ -380,8 +378,6 @@ extern char* ipm_mpi_type[MAXNUM_MPI_TYPES]; + else if( mpitype==MPI_2INTEGER ) ipmtype=IPM_MPI_2INTEGER; \ + else if( mpitype==MPI_2REAL ) ipmtype=IPM_MPI_2REAL; \ + else if( mpitype==MPI_2DOUBLE_PRECISION ) ipmtype=IPM_MPI_2DOUBLE_PRECISION; \ +- else if( mpitype==MPI_2COMPLEX ) ipmtype=IPM_MPI_2COMPLEX; \ +- else if( mpitype==MPI_2DOUBLE_COMPLEX ) ipmtype=IPM_MPI_2DOUBLE_COMPLEX; \ + else ipmtype=0; \ + } + +diff --git a/src/mod_mpi.c b/src/mod_mpi.c +index 00ca4ab..d91e853 100755 +--- a/src/mod_mpi.c ++++ b/src/mod_mpi.c +@@ -94,8 +94,6 @@ int mod_mpi_init(ipm_mod_t* mod, int flags) + ipm_mpi_type[IPM_MPI_2INTEGER] = "MPI_2INTEGER"; + ipm_mpi_type[IPM_MPI_2REAL] = "MPI_2REAL"; + ipm_mpi_type[IPM_MPI_2DOUBLE_PRECISION] = "MPI_2DOUBLE_PRECISION"; +- ipm_mpi_type[IPM_MPI_2COMPLEX] = "MPI_2COMPLEX"; +- ipm_mpi_type[IPM_MPI_2DOUBLE_COMPLEX] = "MPI_2DOUBLE_COMPLEX"; + + mod->state = STATE_ACTIVE; + return IPM_OK; + + -- cgit v1.2.3-60-g2f50