Skip to content

Commit

Permalink
HPC RSE: improving the parallel scaling of Python
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward-RSE authored Feb 23, 2024
2 parents 12b5647 + 60d2d35 commit b1da0d8
Show file tree
Hide file tree
Showing 99 changed files with 10,387 additions and 4,758 deletions.
61 changes: 30 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: C/C++ CI

name: "Python: continuous integration tests"
on:
push:
branches:
Expand All @@ -11,58 +10,47 @@ on:
- "main"
env:
PYTHON: ${{ github.workspace }}

jobs:
greeting_job:
greeting:
name: Greeting job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Print out environment variables"
run: |
echo "WORKSPACE IS $GITHUB_WORKSPACE $PYTHON"
$PYTHON/bin/Setup_Py_Dir
echo "WORKSPACE IS $GITHUB_WORKSPACE"
echo "PYTHON ENV VARIABLE IS: $PYTHON"
build:
build_and_test:
name: Build Python and run tests
runs-on: ubuntu-latest
needs: greeting
steps:
- uses: actions/checkout@v3
- name: configure
#- name: "Installing build dependencies"
# run: sudo apt update && apt install -y build-essential cmake

- name: Configuring Python
run: ./configure
- name: make gh_workflow_install
- name: Build GH Workflow version of Python
run: make gh_workflow_install

run:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.x' # Version range

- name: Install dependencies
- name: Install Python (the language) dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
cd $PYTHON/examples/gh-workflow/
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: compile helper programs and setup
run: |
cd $PYTHON/source/
make clean
make CC=gcc INDENT=no all
make clean
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/Setup_Py_Dir
# - name: Compile programs, again
# run: |
# cd $PYTHON/source
# make CC=gcc INDENT=no all

- name: balmer test
run: |
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/py -f -v 1 balmer_test
python $PYTHON/py_progs/balmer_decrement.py balmer_test
- name: read in parameter files
- name: Checking Python compiled and can read in inputs correctly
run: |
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/Setup_Py_Dir
Expand All @@ -76,3 +64,14 @@ jobs:
$PYTHON/bin/py -i ngc5548
$PYTHON/bin/py -i lamp_post
$PYTHON/bin/py -i cv_standard_import
- name: Running unit tests
run: |
cd $PYTHON/source/tests
make check CC=gcc
- name: Running Balmer test case
run: |
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/py -f -v 1 balmer_test
python $PYTHON/py_progs/balmer_decrement.py balmer_test
52 changes: 43 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ project(Python LANGUAGES C)

# The C standard is being set to 90. The compiler is being set to mpicc

set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_COMPILER mpicc)
set(CMAKE_CXX_COMPILER mpixx)
include_directories(include)
link_directories(lib)
add_definitions(-DMPI_ON)

# Set the Python version, which is going to be appended to source/version.h

set(PYTHON_VERSION 87b)
set(PYTHON_VERSION 87g)
message(STATUS "Python version : ${PYTHON_VERSION}")

# Create the version.h file. During the configure process, the file version.h
Expand Down Expand Up @@ -69,6 +70,7 @@ endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
set(CUDA_SOURCE source/matrix_gpu.cu)

set(PYTHON_SOURCE
${CUDA_SOURCE}
source/agn.c
source/atomicdata.c
source/atomicdata_init.c
Expand Down Expand Up @@ -173,15 +175,28 @@ set(PYTHON_SOURCE
source/photon_gen_matom.c
source/disk_photon_gen.c
source/matrix_cpu.c
${CUDA_SOURCE})
source/define_wind.c
source/communicate_wind.c
source/communicate_plasma.c
source/communicate_macro.c
source/communicate_spectra.c
source/janitor.c
)

set(PY_WIND_SOURCE source/py_wind_ion.c source/py_wind_macro.c
source/py_wind_sub.c source/py_wind_write.c)
source/py_wind_sub.c source/py_wind_write.c
source/define_wind.c
source/communicate_wind.c
source/communicate_spectra.c)

set(WINDSAVE2TABLE_SOURCE source/windsave2table_sub.c)
set(WINDSAVE2TABLE_SOURCE source/windsave2table_sub.c
source/define_wind.c
source/communicate_wind.c)

set(RAD_HYDRO_SOURCE source/rad_hydro_files.c)

set(MODIFY_WIND_SOURCE source/modify_wind.c)

set(INSPECT_WIND_SOURCE source/inspect_wind.c)

set(OPTICAL_DEPTH_SOURCE
Expand All @@ -192,10 +207,13 @@ set(TEST_SOURCE
source/tests/unit_test_main.c
source/tests/tests/test_matrix.c
source/tests/tests/test_compton.c
${PYTHON_SOURCE})

#${CUDA_SOURCE})

${PYTHON_SOURCE}
source/define_wind.c
source/tests/tests/test_define_wind.c
source/communicate_wind.c
source/tests/unit_test_model.c
source/tests/tests/test_run_mode.c
)

# Create the executables for each program, and link the required libraries

Expand All @@ -212,6 +230,22 @@ add_executable(windsave2table source/windsave2table.c ${PYTHON_SOURCE}
${WINDSAVE2TABLE_SOURCE})
target_link_libraries(windsave2table gsl gslcblas m)

# rad_hydro_files
add_executable(rad_hydro_files ${PYTHON_SOURCE} ${RAD_HYDRO_SOURCE})
target_link_libraries(rad_hydro_files gsl gslcblas m)

# modify_wind
add_executable(modify_wind ${PYTHON_SOURCE} ${MODIFY_WIND_SOURCE})
target_link_libraries(modify_wind gsl gslcblas m)

# inspect_wind
add_executable(inspect_wind ${PYTHON_SOURCE} ${INSPECT_WIND_SOURCE})
target_link_libraries(inspect_wind gsl gslcblas m)

# py_optd
add_executable(py_optd ${PYTHON_SOURCE} ${OPTICAL_DEPTH_SOURCE})
target_link_libraries(py_optd gsl gslcblas m)

# test
add_executable(py_unit_test ${TEST_SOURCE})
target_link_libraries(py_unit_test m gsl gslcblas cunit)
1 change: 0 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ endif
MAKE_PYTHON = \
cd $(PYTHON)/source; \
make CC=$(CMAKE) INDENT=no all \
$(MAKE_CHECK)

# Compile and install the libraries and Python
install:
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/source/developer/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ implementation. If you need to create your own assertion, these should be kept i
/* Use the following assertion to compare the value of the "correct" values (vector_x)
against the output from `solve_matrix` (test_vector_x) */
CU_CHECK_DOUBLE_ARRAY_EQ_FATAL(test_vector_x, vector_x, vector_size, EPSILON); /* Custom from assert.h */
CU_ASSERT_DOUBLE_ARRAY_EQUAL_FATAL(test_vector_x, vector_x, vector_size, EPSILON); /* Custom from assert.h */
free(matrix_a);
free(vector_b);
Expand Down
1 change: 1 addition & 0 deletions examples/regress/commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ py -ignore_partial_cells agn_simple.pf
# py cv_vert.pf
# py star.pf
# py two.pf
# py cv_standard_import.pf
Loading

0 comments on commit b1da0d8

Please sign in to comment.