Skip to content

Conversation

@technic960183
Copy link
Member

@technic960183 technic960183 commented Oct 4, 2025

About this PR

This pull request introduces the environment setup script and the machine configuration file for the GitHub-hosted GitHub Actions runners, making it easier for the CI pipeline to configure and compile GAMER on GitHub-hosted Actions runners.

Rationale

  • Prepare the compiling environment for our future CI pipeline to test if GAMER could compile successfully.
  • Provide the environment for GitHub Copilot coding agent to compile GAMER on GitHub-hosted runner.

Changes

Environment setup for GitHub Actions

  • Added .github/install_gamer_env.sh script to automate the installation of the necessary dependencies (OpenMPI, HDF5, CUDA toolkit), print out the status of their installation, and configure machine-specific settings for GAMER on GitHub-hosted runners.
  • Added .github/workflows/copilot-setup-steps.yml workflow to automatically prepare the environment for Copilot Coding Agents by running the script above.

Configuration for GitHub Actions runners

  • Added configs/github_action.config with paths and compiler settings for GitHub-hosted Ubuntu runners, including CUDA, MPI, and HDF5 locations, as well as compiler flags.

Usage

Example config for future CI.

name: My GAMER Workflow

on:
  push:
    branches: [ main ]

jobs:
  compile-and-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      
      - name: Setup GAMER Environment
        run: bash .github/install_gamer_env.sh
      
      - name: Generate Makefile
        run: |
          cd src
          cp ../example/test_problem/Hydro/Riemann/generate_make.sh ./
          bash generate_make.sh --openmp=false --mpi=false --gpu=false
      
      - name: Compile GAMER
        run: |
          cd src
          make clean
          make -j4
      
      - name: Run Test
        run: |
          mkdir -p bin/test
          cd bin/test
          cp -r ../../example/test_problem/Hydro/Riemann/* .
          cp ../../src/gamer .
          ./gamer
          tail -n 3 Record__Note

Notes

This is the first PR in GAMER contributed by a robot!
See technic960183#3 for the record of tasks that contribute to this pull request.

Copilot Generate Test Report

Please check gamer-project#2 for the original test environment.

GAMER Environment Setup Test Report

Summary

All tests passed successfully! The GAMER environment is properly configured and functional.


1D Shock Tube Tests (doc/wiki/Quick-Start-related/Quick-Start:-1D-Shock-Tube.md)

✅ Test 1: CPU-only without OpenMP

  • Configuration: --openmp=false
  • Compilation: ✅ Success
  • Execution: ✅ Success
  • Output: Simulation completed with "~ GAME OVER ~"
  • Performance: 48.92 seconds
  • Files generated: Record__* logs and Xline_* data files

✅ Test 2: CPU-only with OpenMP

  • Configuration: --openmp=true
  • Compilation: ✅ Success
  • Execution: ✅ Success with 4 threads
  • OpenMP Diagnosis:
    • Schedule: DYNAMIC
    • NThread: 4 (as configured)
    • Different threads using different CPU cores: ✅ Confirmed
  • Performance: 21.66 seconds (~2.26x speedup vs no OpenMP)
  • Output: Simulation completed with "~ GAME OVER ~"

✅ Test 3: Hybrid OpenMP/GPU (compile only)

  • Configuration: --openmp=true --gpu=true
  • Compilation: ✅ Success
  • GPU Compute Capability: 750 (detected and configured)
  • CUDA Files: All GPU kernels compiled successfully

3D Blast Wave Tests (doc/wiki/Quick-Start-related/Quick-Start:-3D-Blast-Wave.md)

✅ Test 4: OpenMP/MPI/HDF5 (no GPU)

  • Configuration: --openmp=true --gpu=false --mpi=true --hdf5=true
  • Compilation: ✅ Success
  • Execution: ✅ Success with 2 MPI processes, 4 OpenMP threads per process
  • Runtime: 180 seconds (timeout as expected)
  • MPI Configuration:
    • Rank 0: 4 threads
    • Rank 1: 4 threads
    • Load balancing: HILBERT
  • HDF5 Output: ✅ Data files generated (Data_000000, Data_000001)
  • Log Files: All Record__* files generated correctly

✅ Test 5: OpenMP/GPU/MPI/HDF5 (compile only)

  • Configuration: --openmp=true --gpu=true --mpi=true --hdf5=true
  • Compilation: ✅ Success
  • GPU Compute Capability: 750
  • CUDA/MPI Integration: All GPU and MPI code compiled successfully

Environment Details

Dependencies Verified

  • ✅ MPI: OpenMPI installed (/usr/bin/mpicxx)
  • ✅ HDF5: Installed at /usr/lib/x86_64-linux-gnu/hdf5/serial
  • ✅ CUDA: NVCC available at /usr/bin/nvcc
  • ✅ Machine Configuration: github_action profile configured

Compilation Flags

  • C++ Compiler: g++ (serial) / mpicxx (MPI)
  • Optimization: -O2
  • OpenMP Flag: -fopenmp
  • GPU Arch: compute_75,sm_75 (Turing architecture)

Conclusions

  1. All compilation targets work correctly: CPU-only, OpenMP, GPU, MPI, HDF5, and all combinations
  2. OpenMP parallelization is functional: Proper thread distribution across CPU cores with expected speedup
  3. MPI support is operational: Multi-process execution with load balancing works
  4. GPU compilation is successful: All CUDA kernels compile with proper compute capability detection
  5. HDF5 output works: Data files are properly generated in HDF5 format
  6. No environment setup issues: All dependencies pre-installed and configured correctly

The GAMER environment is ready for production use in the GitHub Actions CI/CD pipeline.

Original prompt

Please help me to test if the copilot env setup can run successfully.
Follow doc/wiki/Quick-Start-related/Quick-Start:-1D-Shock-Tube.md to test if all three options can compile and the first two can execute successfully.

  1. CPU-only without OpenMP
  2. CPU-only with OpenMP
  3. Hybrid OpenMP/GPU (compile only, no GPU access for gh-action)

Then test the 3D version: doc/wiki/Quick-Start-related/Quick-Start:-3D-Blast-Wave.md
Compile with generate_make.sh --openmp=true --gpu=false --mpi=true --hdf5=true and run 180 sec to check if it run correctly (timeout is normal).
Then compile with generate_make.sh --openmp=true --gpu=true --mpi=true --hdf5=true to check if it can compile correctly. (Don't run it)

If you find that the env is not install. Try to run .github/install_gamer_env.sh by bash. This should install everything you need.
The quick start will ask you to draw the figures but you should skip it, as you can only interact with me and the terminal via text.
If everything works fine, please write a detail report in the PR message. If anything goes wrong, report to me and try to solve it.

@technic960183 technic960183 changed the title Gh action runner Add Environment for Supporting GAMER on GitHub Action Runners Oct 4, 2025
@technic960183 technic960183 changed the title Add Environment for Supporting GAMER on GitHub Action Runners Add Environment for GAMER on GitHub Action Runners Oct 4, 2025
@hyschive hyschive requested a review from hfhsieh November 10, 2025 09:38
@hyschive hyschive requested review from hfhsieh and xuanweishan and removed request for hfhsieh and xuanweishan November 10, 2025 09:39
Copy link
Contributor

@hfhsieh hfhsieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I have left a few comments. Also, should we consider renaming the file github_action.config to github_runner_linux.config, github_server_linux.config, or github_linux.config? I suggest this because a GitHub Action refers to the workflow, not the server running it.

NVCCFLAG_POT -Xptxas -dlcm=ca

# 4. Set the GPU Compute Capability
GPU_COMPUTE_CAPABILITY 750 # NVIDIA Tesla T4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing space.

# 1. Paths
CUDA_PATH /usr
FFTW2_PATH /path/to/fftw2
FFTW3_PATH /path/to/fftw3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set either FFTW2_PATH or FFTW3_PATH if we want to compile/run test problems that require gravity for CI/CD? The 1D Shock Tube and 3D Blast Wave tests do not rely on gravity, so they will work without these settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants