Coder Social home page Coder Social logo

pkestene / ppkmhd Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 6.0 2.13 MB

MPI+Kokkos implementation of spectral difference method (SDM) high order schemes

License: Other

CMake 2.61% Python 0.23% Shell 0.23% C++ 94.40% C 0.28% Jupyter Notebook 2.24%
cfd cuda gpu gpu-computing hpc kokkos cea parallel-computing performance-portability

ppkmhd's Introduction

DOI C/C++ CI

ppkMHD

What is it ?

ppkMHD stands for Performance Portable Kokkos for Magneto-HydroDynamics (MHD) solvers.

Here a small list of numerical schemes implementations:

  • second order MUSCL-HANCOCK scheme for hydrodynamics and MHD
  • high-order MOOD (hydrodynamics only)
  • high-order Spectral Difference Method schemes: hydrodynamics only

All scheme are available in 2D and 3D using Kokkos+MPI implementation, and support at least the OpenMP and CUDA kokkos backends (other backends may be used, but not tested).

Dependencies

  • Kokkos library will either be built by ppkMHD by using cmake option -DPPKMHD_BUILD_KOKKOS=ON, either be detected if you already have it installed.
  • cmake with version >= 3.X (3.X is chosen to meet Kokkos own requirement for cmake; i.e. it might increase in the future)

For beginner user, wu suggest that you build ppkMHD with -DPPKMHD_BUILD_KOKKOS=ON so that Kokkos is built together, with the same flags as the main application.

Build

A few example builds, with minimal configuration options.

If you already have Kokkos installed

If you build kokkos yourself, we advise you to always active HWLOC TPLS.

Just make sure that your env variable CMAKE_PREFIX_PATH point to the location where Kokkos where installed. More precisely if Kokkos is installed in KOKKOS_ROOT, you add $KOKKOS_ROOT/lib/cmake to your CMAKE_PREFIX_PATH; this way kokkos will be found automagically by cmake, and the right Kokkos hardware backend will be selected.

# cd into ppkMHD toplevel sources
cmake -S . -B _build/default -DPPKMHD_BUILD_KOKKOS=OFF
cmake --build _build/default -j 6

Build ppkMHD and kokkos without MPI activated for Kokkos-openmp backend

  • Create a build directory, configure and make
# cd into ppkMHD toplevel sources
cmake -S . -B _build/openmp -DPPKMHD_BUILD_KOKKOS=ON -DPPKMHD_USE_MPI=OFF -DPPKMHD_BACKEND=OpenMP -DKokkos_ENABLE_HWLOC=ON
cmake --build _build/openmp -j 6

Add variable CXX on the cmake command line to change the compiler (clang++, icpc, pgcc, ....).

Build ppkMHD and kokkos without MPI activated for Kokkos-cuda backend

  • Create a build directory, configure and make
# cd into ppkMHD toplevel sources
cmake -S . -B _build/cuda -DPPKMHD_BUILD_KOKKOS=ON -DPPKMHD_USE_MPI=OFF -DPPKMHD_BACKEND=Cuda
# note: GPU architecture will be detected when building on a host with a GPU; if you're building on a host, and running on another machine
# you'll need to tell kokkos what is the target architecture, e.g. add flag like '-DKokkos_ARCH_TURING75=ON' on the cmake configure line
cmake --build _build/cuda -j 6

Build ppkMHD with MPI activated for Kokkos-cuda backend

Please make sure to use a CUDA-aware MPI implementation (OpenMPI or MVAPICH2) built with the proper flags for activating CUDA support.

It may happen that eventhough your MPI implementation is actually cuda-aware, cmake MPI detection (through a call to find_package(MPI) macro) may fails to detect if your MPI implementation is cuda aware. In that case, you can enforce cuda awareness by turning option PPKMHD_USE_MPI_CUDA_AWARE_ENFORCED to ON.

You don't need to use mpi compiler wrapper mpicxx, cmake should be able to correctly populate MPI_CXX_INCLUDE_PATH, MPI_CXX_LIBRARIES which are passed to all final targets by using the alias library MPI::MPI_CXX.

  • Create a build directory, configure and make
mkdir build; cd build
cmake -DPPKMHD_USE_MPI=ON -DPPKMHD_BACKEND=Cuda -DKokkos_ARCH_TURING75=ON ..
make -j 4

Example command line to run the application (1 GPU used per MPI task)

mpirun -np 4 ./ppkMHD ./test_implode_2D_mpi.ini

Additionnal features

In order to activate building SDM (Spectral Difference Method) schemes, use cmake option -DPPKMHD_USE_SDM=ON.

The MOOD numerical scheme require some linear algebra (QR decomposition) on the host (not device). This is done using a Blas/Lapack implementation using the C language interface named Lapacke.

Please note that Atlas doesn't provide Lapackage. Currently (March 2017), on Ubuntu 16.04, package libatlas-dev is not compatible with package Lapacke (generate errors at link time). So please either Netlib/Lapack or OpenBLAS implementation.

If you want to enforce the use of OpenBLAS, just use a recent cmake (>=3.6) and add -DBLA_VENDOR on the cmake command line. This will tell the cmake build system (through the call to find_package(BLAS) ) to only look for the OpenBLAS implementation.

On a recent Ubuntu, if atlas is not installed, but OpenBLAS is, you don't need to have a bleeding edge cmake, current cmake will find OpenBLAS.

See also

ppkmhd's People

Contributors

pgrete avatar pkestene avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ppkmhd's Issues

Unable to compile ppKMHD on Ubuntu 20.04

Hi, pkestene. I am trying to install ppKMHD on a Ubuntu 20.04 sever, but I got compile errors. Here was the installation process:

  1. Clone the repo and update the submodule
    git clone https://github.com/pkestene/ppkMHD.git
    git submodule init
    git submodule update
  2. Build without MPI / With Kokkos-openmp
  • create a build dir
    mkdir build & cd build
  • cmake command
    cmake -DUSE_MPI=OFF -DKokkos_ENABLE_OPENMP=ON -DKokkos_ENABLE_HWLOC=ON -DUSE_SDM=ON ../
    The cmake output messages are:

-- The C compiler identification is GNU 5.5.0
-- The CXX compiler identification is GNU 5.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so (found version "3.1")
-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- Could NOT find PAPI (missing: PAPI_LIBRARY PAPI_INCLUDE_DIR)
-- Setting default Kokkos CXX standard to 11
-- The project name is: Kokkos
-- Using -std=c++11 for C++11 standard as feature
-- Execution Spaces:
-- Device Parallel: NONE
-- Host Parallel: OPENMP
-- Host Serial: NONE
--
-- Architectures:
-- Found TPLHWLOC: /usr/lib/x86_64-linux-gnu/libhwloc.so
-- Found TPLLIBDL: /usr/lib/x86_64-linux-gnu/libdl.so
-- Found OpenMP_C: -fopenmp (found version "4.0")
-- Found OpenMP_CXX: -fopenmp (found version "4.0")
-- Found OpenMP: TRUE (found version "4.0")
//===================================================
ppkMHD build configuration:
//===================================================
C++ Compiler : GNU 5.5.0
/usr/bin/c++
MPI not enabled
Kokkos OpenMP enabled : ON
Kokkos CUDA enabled : OFF
Kokkos HWLOC enabled : ON
SDM enabled : ON
MOOD enabled : OFF
DOUBLE precision : ON
HWLOC enabled : ON
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yjy/Documents/ppkMHD/build

  • build
    make -j4
    but I get compile errors, the massages are :

build git:(master) โœ— make -j4 2> errors.log
Scanning dependencies of target config
Scanning dependencies of target kokkoscore
Scanning dependencies of target monitoring
[ 1%] Building CXX object src/utils/config/CMakeFiles/config.dir/inih/ini.cpp.o
[ 2%] Building CXX object src/utils/config/CMakeFiles/config.dir/ConfigMap.cpp.o
[ 3%] Building CXX object src/utils/monitoring/CMakeFiles/monitoring.dir/OpenMPTimer.cpp.o
[ 4%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_CPUDiscovery.cpp.o
[ 6%] Building CXX object src/utils/monitoring/CMakeFiles/monitoring.dir/SimpleTimer.cpp.o
[ 7%] Building CXX object src/utils/config/CMakeFiles/config.dir/inih/INIReader.cpp.o
[ 8%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Core.cpp.o
[ 9%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Error.cpp.o
[ 10%] Linking CXX static library libmonitoring.a
[ 10%] Built target monitoring
[ 12%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_ExecPolicy.cpp.o
[ 13%] Linking CXX static library libconfig.a
[ 14%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_HostBarrier.cpp.o
[ 14%] Built target config
Scanning dependencies of target ConfigMapTest
[ 15%] Building CXX object test/configMap/CMakeFiles/ConfigMapTest.dir/ConfigMapTest.cpp.o
[ 16%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_HostSpace.cpp.o
[ 18%] Linking CXX executable ConfigMapTest
[ 19%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_HostSpace_deepcopy.cpp.o
[ 20%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_HostThreadTeam.cpp.o
[ 21%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_MemoryPool.cpp.o
[ 21%] Built target ConfigMapTest
[ 22%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_MemorySpace.cpp.o
[ 24%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Profiling.cpp.o
[ 25%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Serial_Task.cpp.o
[ 26%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_SharedAlloc.cpp.o
[ 27%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Spinwait.cpp.o
[ 28%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_Stacktrace.cpp.o
[ 30%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/impl/Kokkos_hwloc.cpp.o
[ 31%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/OpenMP/Kokkos_OpenMP_Exec.cpp.o
[ 32%] Building CXX object external/kokkos/core/src/CMakeFiles/kokkoscore.dir/OpenMP/Kokkos_OpenMP_Task.cpp.o
[ 33%] Linking CXX static library libkokkoscore.a
[ 33%] Built target kokkoscore
Scanning dependencies of target kokkoscontainers
[ 34%] Building CXX object external/kokkos/containers/src/CMakeFiles/kokkoscontainers.dir/impl/Kokkos_UnorderedMap_impl.cpp.o
[ 36%] Linking CXX static library libkokkoscontainers.a
[ 36%] Built target kokkoscontainers
Scanning dependencies of target test_euler_eigen_decomposition
Scanning dependencies of target query_device_kokkos
Scanning dependencies of target shared
Scanning dependencies of target test_sdm_lagrange_flux2sol_derivative_interpolation
[ 37%] Building CXX object test/kokkos/CMakeFiles/query_device_kokkos.dir/query_device_kokkos.cpp.o
[ 38%] Building CXX object test/sdm/CMakeFiles/test_sdm_lagrange_flux2sol_derivative_interpolation.dir/test_sdm_lagrange_flux2sol_derivative_interpolation.cpp.o
[ 39%] Building CXX object test/shared/CMakeFiles/test_euler_eigen_decomposition.dir/test_euler_eigen_decomposition.cpp.o
[ 40%] Building CXX object src/shared/CMakeFiles/shared.dir/HydroParams.cpp.o
[ 42%] Linking CXX executable query_device_kokkos
[ 42%] Built target query_device_kokkos
[ 43%] Building CXX object src/shared/CMakeFiles/shared.dir/SolverBase.cpp.o
Scanning dependencies of target muscl
[ 44%] Building CXX object src/muscl/CMakeFiles/muscl.dir/SolverHydroMuscl.cpp.o
[ 45%] Linking CXX executable test_euler_eigen_decomposition
[ 45%] Built target test_euler_eigen_decomposition
[ 46%] Building CXX object src/shared/CMakeFiles/shared.dir/utils.cpp.o
Scanning dependencies of target solver_factory
[ 48%] Building CXX object src/shared/CMakeFiles/solver_factory.dir/SolverFactory.cpp.o
[ 49%] Linking CXX executable test_sdm_lagrange_flux2sol_derivative_interpolation
[ 49%] Built target test_sdm_lagrange_flux2sol_derivative_interpolation
Scanning dependencies of target test_sdm_geom
[ 50%] Building CXX object test/sdm/CMakeFiles/test_sdm_geom.dir/test_sdm_geom.cpp.o
[ 51%] Linking CXX static library libshared.a
[ 51%] Built target shared
Scanning dependencies of target test_sdm_lagrange_sol2sol_derivative
[ 53%] Building CXX object test/sdm/CMakeFiles/test_sdm_lagrange_sol2sol_derivative.dir/test_sdm_lagrange_sol2sol_derivative.cpp.o
[ 54%] Linking CXX executable test_sdm_geom
[ 54%] Built target test_sdm_geom
Scanning dependencies of target test_sdm_lagrange_sol2flux
[ 55%] Building CXX object test/sdm/CMakeFiles/test_sdm_lagrange_sol2flux.dir/test_sdm_lagrange_sol2flux.cpp.o
[ 56%] Linking CXX executable test_sdm_lagrange_sol2sol_derivative
[ 56%] Built target test_sdm_lagrange_sol2sol_derivative
Scanning dependencies of target test_sdm_chebyshev_quadrature
[ 57%] Building CXX object test/sdm/CMakeFiles/test_sdm_chebyshev_quadrature.dir/test_sdm_chebyshev_quadrature.cpp.o
[ 59%] Building CXX object src/muscl/CMakeFiles/muscl.dir/SolverMHDMuscl.cpp.o
[ 60%] Linking CXX executable test_sdm_chebyshev_quadrature
[ 60%] Built target test_sdm_chebyshev_quadrature
Scanning dependencies of target io
[ 61%] Linking CXX executable test_sdm_lagrange_sol2flux
[ 62%] Building CXX object src/utils/io/CMakeFiles/io.dir/IO_common.cpp.o
[ 62%] Built target test_sdm_lagrange_sol2flux
[ 63%] Building CXX object src/utils/io/CMakeFiles/io.dir/IO_ReadWrite.cpp.o
[ 65%] Building CXX object src/utils/io/CMakeFiles/io.dir/IO_VTK.cpp.o
[ 66%] Building CXX object src/utils/io/CMakeFiles/io.dir/IO_ReadWrite_SDM.cpp.o
[ 67%] Linking CXX static library libmuscl.a
[ 67%] Built target muscl
[ 68%] Building CXX object src/utils/io/CMakeFiles/io.dir/IO_VTK_SDM_shared.cpp.o
src/utils/io/CMakeFiles/io.dir/build.make:134: recipe for target 'src/utils/io/CMakeFiles/io.dir/IO_ReadWrite_SDM.cpp.o' failed
CMakeFiles/Makefile2:2303: recipe for target 'src/utils/io/CMakeFiles/io.dir/all' failed
^Csrc/shared/CMakeFiles/solver_factory.dir/build.make:62: recipe for target 'src/shared/CMakeFiles/solver_factory.dir/SolverFactory.cpp.o' failed
CMakeFiles/Makefile2:2361: recipe for target 'src/shared/CMakeFiles/solver_factory.dir/all' failed
Makefile:140: recipe for target 'all' failed

The following .log file gives a detailed message:
error.log

The compiler I used is g++-5.5. Actually, I had tested g++-6, g++-8.1, but they all failed to work. I think the problems are in the VTK write classes.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.