Code Monkey home page Code Monkey logo

hpcpp's Introduction

hpcpp

Standard C++26 High-Performance Computing (HPC) applications that run on CPUs and GPUs.

Build

git clone https://github.com/NERSC/hpcpp.git
cd hpcpp; mkdir build ; cd build
ml nvhpc/23.7 cmake 3.24

# enable GPU support by setting -DSTDPAR=gpu (default)
cmake .. -DSTDPAR=<gpu/multicore> -DOMP=<gpu/multicore; 
make -j 10

Note: Make sure your localrc file (located at /path/to/nvhpc/bin) is properly configured to GCC >= 11.2.0 paths.

NERSC Users

You can also use the pre-configured localrc file included in this repo. To use it, run:

export GCCLOCALRC=/path/to/hpcpp/scripts/pm-localrc/localrc

Note: Please uncomment the following line in apps/fft/CMakeLists.txt if using nvc++ version < 23.7?

  # uncomment only if using nvc++ earlier than 23.7 to find libcublas
  # target_link_directories(${exec_name} PRIVATE /opt/nvidia/hpc_sdk/Linux_x86_64/23.1/math_libs/lib64)

Run Apps

cd hpcpp/build
srun -n 1 -N 1 -G <> -A <acct> -t 30 -C <cpu/gpu> ./apps/<appname>/<appname> [ARGS]

Use --help to see help with arguments.

Contributors

(in alphabetical order of last name)

License

Copyright (C) The Regents of the University of California, 2023 (See LICENSE for details).

hpcpp's People

Contributors

mhaseeb123 avatar weilewei avatar hcq9102 avatar

Stargazers

Phillip Rhodes avatar  avatar George L. Albany avatar Pierre Kestener avatar ZigRazor avatar Karthikeyan avatar leonayu avatar

Watchers

Jack Deslippe avatar Annette Greiner avatar Shane Canon avatar Chris Harris avatar Douglas Jacobsen avatar Rebecca Hartman-Baker avatar  avatar Nestor Demeure avatar Rahulkumar Gayatri avatar Steve Leak avatar  avatar

hpcpp's Issues

fix or reproduce stdexec errors

possible solutions:

  1. separate out CPU and GPU schedulers implementations into two cpp files
  2. reproduce the error with standalone cpp files (no dependencies) and share it with stdexec team.

Apps using `repeat_n` fail to build with `-stdpar=multicore`

hpcpp apps including both stencils fail to build when -stdpar=multicore (aka CMake -DSTDPAR=multicore). The build errors originate from the repeat_n.cuh file adapter from nvidia/stdexec.

Possible fixes:

  1. Quick (and temporary fix): Use compiler directives #if defined(USE_GPU) to disable code using repeat_n and provide alternative implementation
  2. Implement a repeat_n sender for CPU scheduler.

reproduce prefix sum with stdexec

cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(hpcpp LANGUAGES CXX CUDA)

set(CXX_STANDARD_REQUIRED ON)

# required minimum CXX standard
set(CMAKE_CXX_STANDARD_REQUIRED 23)

set(CPM_DOWNLOAD_VERSION 0.35.6)

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
  cmake_policy(SET CMP0135 NEW)
endif()

if(CPM_SOURCE_CACHE)
  set(CPM_DOWNLOAD_LOCATION
      "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
  set(CPM_DOWNLOAD_LOCATION
      "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
  set(CPM_DOWNLOAD_LOCATION
      "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
  message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
  file(
    DOWNLOAD
    https://github.com/TheLartians/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
    ${CPM_DOWNLOAD_LOCATION})
endif()

include(${CPM_DOWNLOAD_LOCATION})

cpmaddpackage(
  NAME
  stdexec
  GITHUB_REPOSITORY
  NVIDIA/stdexec
  GIT_TAG
  main# This will always pull the latest code from the `main` branch. You may
       # also use a specific release version or tag
  OPTIONS
  "STDEXEC_ENABLE_CUDA ON"
  "STDEXEC_BUILD_EXAMPLES OFF"
  "STDEXEC_BUILD_TESTS OFF"
  "STDEXEC_ENABLE_IO_URING_TESTS OFF"
  "BUILD_TESTING OFF")

set(CMAKE_CXX_FLAGS
  "${CMAKE_CXX_FLAGS} -stdpar=gpu -mp=gpu")

add_executable(main main.cpp)
target_link_libraries(main stdexec)

formatting

We need a formatting file for project files (cpp and hpp) and cmake files for CI and guideline purpose.

remove magic_enum

We aren't using magic_enum in our apps so far as it requires advanced compiler features not available in nvc++ yet. We can remove this and it's instances if any from CMake files too to avoid baggage.

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.