Commit 34aeefdf authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Merge branch 'atpesc2024' into 'master'

Multi-GPU offloading

See merge request giacomo.mulas/np_tmcode!55
parents 44affb8a 5312a383
Loading
Loading
Loading
Loading

CITATION.cff

0 → 100644
+28 −0
Original line number Diff line number Diff line
authors:
  - family-names: La Mura, Mulas, Saija
    given-names: Giovanni, Giacomo, Rosalba
cff-version: 1.2.0
license: GNU GPLv3
message: "If you use this software, please cite the references below."
repository-code: "https://www.ict.inaf.it/gitlab/giacomo.mulas/np_tmcode"
title: "Nano-particle Transition Matrix code"
version: 8.3
references:
  - authors:
    - family-names: Saija, Iatì, Borghese
      given-names: Rosalba, Maria Antonia, Ferdinando
    doi: 10.1086/322350
    issue: 1
    journal: "The Astrophysical Journal"
    title: "Beyond Mie Theory: The Transition Matrix Approach in Interstellar Dust Modeling"
    type: article
    volume: 599
    page: 993
    year: 2001
  - authors:
    - family-names: Borghese, Denti, Saija
      given-names: Ferdinando, Paolo, Rosalba
    doi: 10.1007/978-3-540-37414-5
    title: "Scattering from Model Nonspherical Particles"
    type: book
    year: 2007
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,10 @@ Distributing the code and its sources is possible under the terms of the GNU GPL

*NOTE:* The building process requires a working installation of a C++ and a FORTRAN compiler. Many solutions are available, but the recommended option is the *GNU Compiler Collection* `gcc` with the addition of `g++` and `gfortran`. The parallel code implementation further requires the use of parallel compilers complying with the MPI standard (*OpenMPI*, *MPICH*).

# Acknowledgments

Supported by Italian Research Center on High Performance Computing Big Data and Quantum Computing (ICSC), project funded by European Union - NextGenerationEU - and National Recovery and Resilience Plan (NRRP) - Mission 4 Component 2 within the activities of Spoke 3 (Astrophysics and Cosmos Observations). This work was completed in part at the CINECA GPU HACKATHON 2024, part of the Open Hackathons program. The authors would like to acknowledge OpenACC-Standard.org for their support.

# License

   Copyright (C) 2024   INAF - Osservatorio Astronomico di Cagliari
+0 −2
Original line number Diff line number Diff line
@@ -470,9 +470,7 @@ FFLAGS = @FFLAGS@
FGREP = @FGREP@
FILECMD = @FILECMD@
GREP = @GREP@
HDF5_INCLUDE = @HDF5_INCLUDE@
HDF5_LDFLAGS = @HDF5_LDFLAGS@
HDF5_LIB = @HDF5_LIB@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
+47 −32
Original line number Diff line number Diff line
@@ -669,8 +669,6 @@ OFFLOADFLAGS
BUILDFORTRAN_FALSE
BUILDFORTRAN_TRUE
HDF5_LDFLAGS
HDF5_LIB
HDF5_INCLUDE
CXXCPP
LT_SYS_LIBRARY_PATH
OTOOL64
@@ -9460,8 +9458,6 @@ EOF
      if test "x$CXX_IS_MPI" = "x0"; then
        MPIFLAGS=-DUSE_MPI
        MPIFLAGS=""
      fi
    fi
@@ -24832,39 +24828,52 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Environment setup
if test "x$HDF5_INCLUDE" = "x"
then :
  HDF5_INCLUDE="/usr/include/hdf5/serial"
else case e in #(
  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HDF5_INCLUDE=$(HDF5_INCLUDE)" >&5
printf "%s\n" "$as_me: HDF5_INCLUDE=$(HDF5_INCLUDE)" >&6;}
 ;;
esac
    export -p | grep HDF5_ROOT > /dev/null
    result=$?
    if test "x$result" = "x0"; then
      if test "x$HDF5_INCLUDE" = "x"; then
        export HDF5_INCLUDE=${HDF5_ROOT}/include
      fi
if test "x$HDF5_LIB" = "x"
then :
  HDF5_LIB="/usr/lib/x86_64-linux-gnu/hdf5/serial"
else case e in #(
  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HDF5_LIB=$(HDF5_LIB)" >&5
printf "%s\n" "$as_me: HDF5_LIB=$(HDF5_LIB)" >&6;}
 ;;
esac
      if test "x$HDF5_LIB" = "x"; then
        export HDF5_LIB=${HDF5_ROOT}/lib
      fi
    fi
    export -p | grep HDF5_DIR > /dev/null
    result=$?
    if test "x$result" = "x0"; then
      if test "x$HDF5_INCLUDE" = "x"; then
        export HDF5_INCLUDE=${HDF5_DIR}/include
      fi
      if test "x$HDF5_LIB" = "x"; then
        export HDF5_LIB=${HDF5_DIR}/lib
      fi
    fi
    if test "x$HDF5_INCLUDE" = "x"; then
      export HDF5_INCLUDE="/usr/include/hdf5/serial"
    fi
    if test "x$HDF5_LIB" = "x"; then
      export HDF5_LIB="/usr/lib/x86_64-linux-gnu/hdf5/serial"
    fi
# Check for required headers
as_ac_Header=`printf "%s\n" "ac_cv_header_$HDF5_INCLUDE/hdf5.h" | sed "$as_sed_sh"`
ac_fn_c_check_header_compile "$LINENO" "$HDF5_INCLUDE/hdf5.h" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"
# AC_CHECK_HEADER(
#  [${HDF5_INCLUDE}/hdf5.h],
#  ,
#  AC_MSG_ERROR([Could not find HDF5 headers!]),
# )
if test -f ${HDF5_INCLUDE}/hdf5.h
then :
  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HDF5 headers found in ${HDF5_INCLUDE}" >&5
printf "%s\n" "$as_me: HDF5 headers found in ${HDF5_INCLUDE}" >&6;}
else case e in #(
  e) as_fn_error $? "\"Could not find HDF5 headers!" "$LINENO" 5 ;;
  e) as_fn_error $? "HDF5 headers not found!" "$LINENO" 5
 ;;
esac
fi
# Check for required libraries
    cat > nptm_test_hdf5.cpp <<EOF
@@ -25105,7 +25114,7 @@ then :
    else
    export -p | grep MKL
    export -p | grep MKL > /dev/null
    MKL_DEF=$?
    if test "x$MKL_DEF" = "x0"; then
      export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL -DLAPACK_ILP64 -DUSE_ILP64 -I{MKLROOT}/include"
@@ -25137,7 +25146,7 @@ fi
else case e in #(
  e)
    export -p | grep MKL
    export -p | grep MKL > /dev/null
    MKL_DEF=$?
    if test "x$MKL_DEF" = "x0"; then
      export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL -DLAPACK_ILP64 -DUSE_ILP64 -I{MKLROOT}/include"
@@ -25191,7 +25200,7 @@ then :
    elif test -f /usr/include/cuda.h; then
      CUDAFLAGS="-I/usr/include"
      CUDALDFLAGS="-lcudart"
    elif text "x$CUDA_HOME" != "x"; then
    elif test "x$CUDA_HOME" != "x"; then
      CUDAFLAGS="-I${CUDA_HOME}/include"
      CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
    fi
@@ -25205,6 +25214,9 @@ then :
      elif test "x$MAGMA_HOME" != "x"; then
        export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_HOME}/include"
	export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_HOME}/lib -lmagma"
      elif test "x$MAGMA_ROOT" != "x"; then
        export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_ROOT}/include"
	export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_ROOT}/lib -lmagma"
      fi
    fi
@@ -25234,7 +25246,7 @@ else case e in #(
    elif test -f /usr/include/cuda.h; then
      CUDAFLAGS="-I/usr/include"
      CUDALDFLAGS="-lcudart"
    elif text "x$CUDA_HOME" != "x"; then
    elif test "x$CUDA_HOME" != "x"; then
      CUDAFLAGS="-I${CUDA_HOME}/include"
      CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
    fi
@@ -25248,6 +25260,9 @@ else case e in #(
      elif test "x$MAGMA_HOME" != "x"; then
        export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_HOME}/include"
	export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_HOME}/lib -lmagma"
      elif test "x$MAGMA_ROOT" != "x"; then
        export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_ROOT}/include"
	export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_ROOT}/lib -lmagma"
      fi
    fi
+47 −17
Original line number Diff line number Diff line
@@ -19,10 +19,42 @@ EOF
  ]
)

m4_define(
  [M4_DETECT_HDF5],
  [
    export -p | grep HDF5_ROOT > /dev/null
    result=$?
    if test "x$result" = "x0"; then
      if test "x$HDF5_INCLUDE" = "x"; then
        export HDF5_INCLUDE=${HDF5_ROOT}/include
      fi
      if test "x$HDF5_LIB" = "x"; then
        export HDF5_LIB=${HDF5_ROOT}/lib
      fi
    fi
    export -p | grep HDF5_DIR > /dev/null
    result=$?
    if test "x$result" = "x0"; then
      if test "x$HDF5_INCLUDE" = "x"; then
        export HDF5_INCLUDE=${HDF5_DIR}/include
      fi
      if test "x$HDF5_LIB" = "x"; then
        export HDF5_LIB=${HDF5_DIR}/lib
      fi
    fi
    if test "x$HDF5_INCLUDE" = "x"; then
      export HDF5_INCLUDE="/usr/include/hdf5/serial"
    fi
    if test "x$HDF5_LIB" = "x"; then
      export HDF5_LIB="/usr/lib/x86_64-linux-gnu/hdf5/serial"
    fi
  ]
)

m4_define(
  [M4_DETECT_LAPACK],
  [
    export -p | grep MKL
    export -p | grep MKL > /dev/null
    MKL_DEF=$?
    if test "x$MKL_DEF" = "x0"; then
      export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL -DLAPACK_ILP64 -DUSE_ILP64 -I{MKLROOT}/include"
@@ -45,7 +77,7 @@ m4_define(
    elif test -f /usr/include/cuda.h; then
      CUDAFLAGS="-I/usr/include"
      CUDALDFLAGS="-lcudart"
    elif text "x$CUDA_HOME" != "x"; then
    elif test "x$CUDA_HOME" != "x"; then
      CUDAFLAGS="-I${CUDA_HOME}/include"
      CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
    fi
@@ -59,6 +91,9 @@ m4_define(
      elif test "x$MAGMA_HOME" != "x"; then
        export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_HOME}/include"
	export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_HOME}/lib -lmagma"
      elif test "x$MAGMA_ROOT" != "x"; then
        export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_ROOT}/include"
	export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_ROOT}/lib -lmagma"
      fi
    fi
  ]
@@ -198,7 +233,6 @@ AC_ARG_ENABLE(
      M4_TEST_MPI
      if test "x$CXX_IS_MPI" = "x0"; then
        AC_SUBST([MPIFLAGS], [-DUSE_MPI])
        AC_SUBST([MPIFLAGS], [""])
      fi
    fi
  ]
@@ -217,22 +251,18 @@ AS_IF(
LT_INIT

# Environment setup
AS_IF(
  [test "x$HDF5_INCLUDE" = "x"],
  [AC_SUBST([HDF5_INCLUDE], ["/usr/include/hdf5/serial"])],
  [AC_MSG_NOTICE([HDF5_INCLUDE=$(HDF5_INCLUDE)])]
)
AS_IF(
  [test "x$HDF5_LIB" = "x"],
  [AC_SUBST([HDF5_LIB], ["/usr/lib/x86_64-linux-gnu/hdf5/serial"])],
  [AC_MSG_NOTICE([HDF5_LIB=$(HDF5_LIB)])]
)
M4_DETECT_HDF5

# Check for required headers
AC_CHECK_HEADER(
  [$HDF5_INCLUDE/hdf5.h],
  ,
  AC_MSG_ERROR(["Could not find HDF5 headers!]),
# AC_CHECK_HEADER(
#  [${HDF5_INCLUDE}/hdf5.h],
#  ,
#  AC_MSG_ERROR([Could not find HDF5 headers!]),
# )
AS_IF(
  [test -f ${HDF5_INCLUDE}/hdf5.h],
  [AC_MSG_NOTICE([HDF5 headers found in ${HDF5_INCLUDE}])],
  [AC_MSG_ERROR([HDF5 headers not found!])]
)

# Check for required libraries
Loading