diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a37377ef8..b9ddde223 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: "Test Builds" +name: "Build and Test" on: push: @@ -7,12 +7,13 @@ on: pull_request: branches: - main + - devel jobs: - pyexp: + exp: strategy: matrix: os: [ubuntu-latest] - cc: [gcc, mpicc] + cc: [gcc] name: "Test pyEXP Build" runs-on: ${{ matrix.os }} @@ -25,20 +26,21 @@ jobs: run: | sudo apt-get update sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev libopenmpi-dev + sudo pip install numpy - name: Setup submodule and build run: | git submodule update --init --recursive mkdir -p build/install - - name: Compile pyEXP + - name: Compile EXP if: runner.os == 'Linux' env: CC: ${{ matrix.cc }} working-directory: ./build run: >- cmake - -DENABLE_NBODY=NO + -DENABLE_NBODY=YES -DENABLE_PYEXP=YES -DCMAKE_BUILD_TYPE=Release -DEigen3_DIR=/usr/include/eigen3/share/eigen3/cmake @@ -48,48 +50,12 @@ jobs: - name: Make working-directory: ./build - run: make -j 2 - - # ----------------------------------------------------------------------------------- - - exp: - strategy: - matrix: - os: [ubuntu-latest] - cc: [gcc, mpicc] - - name: "Test Full EXP Build" - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install core dependencies - ubuntu - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev libopenmpi-dev - - - name: Setup submodule and build - run: | - git submodule update --init --recursive - mkdir -p build/install - - - name: Compile Full EXP - Linux - if: runner.os == 'Linux' - env: - CC: ${{ matrix.cc }} - working-directory: ./build - run: >- - cmake - -DENABLE_NBODY=YES - -DENABLE_PYEXP=NO - -DCMAKE_BUILD_TYPE=Release - -DEigen3_DIR=/usr/include/eigen3/share/eigen3/cmake - -DCMAKE_INSTALL_PREFIX=./install - -Wno-dev - .. + run: make -j 4 - - name: Make + - name: CTest Quick working-directory: ./build - run: make -j 2 + run: ctest -L quick + + #- name: CTest Long + #working-directory: ./build + #run: ctest -L long diff --git a/.github/workflows/buildfull.yml b/.github/workflows/buildfull.yml deleted file mode 100644 index eb9c86552..000000000 --- a/.github/workflows/buildfull.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: "Test Builds" - -on: - -jobs: - pyexp: - strategy: - matrix: - os: [macos-latest, ubuntu-latest] - cc: [gcc, mpicc] - - name: "Test pyEXP Build" - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install core dependencies - ubuntu - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev libopenmpi-dev - - - name: Install core dependencies - mac - if: startsWith(matrix.os, 'mac') - run: | - brew update - brew reinstall gcc - brew install eigen fftw hdf5 open-mpi libomp - - - name: Setup submodule and build - run: | - git submodule update --init --recursive - mkdir -p build/install - - - name: Compile pyEXP - Linux - if: runner.os == 'Linux' - env: - CC: ${{ matrix.cc }} - working-directory: ./build - run: >- - cmake - -DENABLE_NBODY=NO - -DENABLE_PYEXP=YES - -DCMAKE_BUILD_TYPE=Release - -DEigen3_DIR=/usr/include/eigen3/share/eigen3/cmake - -DCMAKE_INSTALL_PREFIX=./install - -Wno-dev - .. - - # Note for future: The homebrew paths are for intel only. Once ARM macs are - # supported in here, we'll need to update to /opt/homebrew/... instead - - name: Compile pyEXP - Mac - if: startsWith(matrix.os, 'mac') - env: - CC: ${{ matrix.cc }} - LDFLAGS: -L/usr/local/opt/libomp/lib - CPPFLAGS: -I/usr/local/opt/libomp/include - working-directory: ./build - run: >- - cmake - -DENABLE_NBODY=NO - -DENABLE_PYEXP=YES - -DCMAKE_BUILD_TYPE=Release - -DEigen3_DIR=/usr/local/share/eigen3/cmake - -DCMAKE_INSTALL_PREFIX=./install - -DOpenMP_CXX_INCLUDE_DIR=/usr/local/opt/libomp/include - -DOpenMP_C_INCLUDE_DIR=/usr/local/opt/libomp/include - -Wno-dev - .. - - - name: Make - working-directory: ./build - run: make -j 2 - - # ----------------------------------------------------------------------------------- - - exp: - strategy: - matrix: - os: [macos-latest, ubuntu-latest] - cc: [gcc, mpicc] - - name: "Test Full EXP Build" - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install core dependencies - ubuntu - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev libopenmpi-dev - - - name: Install core dependencies - mac - if: startsWith(matrix.os, 'mac') - run: | - brew update - brew reinstall gcc - brew install eigen fftw hdf5 open-mpi libomp - - - name: Setup submodule and build - run: | - git submodule update --init --recursive - mkdir -p build/install - - - name: Compile Full EXP - Linux - if: runner.os == 'Linux' - env: - CC: ${{ matrix.cc }} - working-directory: ./build - run: >- - cmake - -DENABLE_NBODY=YES - -DENABLE_PYEXP=NO - -DCMAKE_BUILD_TYPE=Release - -DEigen3_DIR=/usr/include/eigen3/share/eigen3/cmake - -DCMAKE_INSTALL_PREFIX=./install - -Wno-dev - .. - - # Note for future: The homebrew paths are for intel only. Once ARM macs are - # supported in here, we'll need to update to /opt/homebrew/... instead - - name: Compile Full EXP - Mac - if: startsWith(matrix.os, 'mac') - env: - CC: ${{ matrix.cc }} - LDFLAGS: -L/usr/local/opt/libomp/lib - CPPFLAGS: -I/usr/local/opt/libomp/include - working-directory: ./build - run: >- - cmake - -DENABLE_NBODY=YES - -DENABLE_PYEXP=NO - -DCMAKE_BUILD_TYPE=Release - -DEigen3_DIR=/usr/local/share/eigen3/cmake - -DCMAKE_INSTALL_PREFIX=./install - -DOpenMP_CXX_INCLUDE_DIR=/usr/local/opt/libomp/include - -DOpenMP_C_INCLUDE_DIR=/usr/local/opt/libomp/include - -Wno-dev - .. - - - name: Make - working-directory: ./build - run: make -j 2 diff --git a/tests/Cube/check.py b/tests/Cube/check.py index 1956e0ee6..b6b0a3eef 100644 --- a/tests/Cube/check.py +++ b/tests/Cube/check.py @@ -1,15 +1,26 @@ -import numpy as np +# open the output log file +file = open("OUTLOG.runS") -# Read the output log file -data = np.loadtxt("OUTLOG.runS", skiprows=6, delimiter="|") +n = 0 # Count lines +mean = [0.0, 0.0, 0.0] # Mean positions -# Columns 4, 5, 6 is mean position -x = np.mean(data[:,3]) -y = np.mean(data[:,4]) -z = np.mean(data[:,5]) +# Open the output log file +# +while (line := file.readline()) != "": + if n >= 6: # Skip the header stuff + v = [float(x) for x in line.split('|')] + mean[0] += v[3] # x pos + mean[1] += v[4] # y pos + mean[2] += v[5] # z pos + n = n + 1 # Count lines -# If the values are close to 0.5, assume it worked -if np.abs(x - 0.5) > 0.15 or np.abs(y - 0.5) > 0.15 or np.abs(z - 0.5) > 0.15: +if n>6: # Sanity check + for i in range(3): + mean[i] = mean[i]/(n-6) - 0.5 + +# If the squared values are close to 0.0, assume it worked +# +if mean[0]*mean[0] > 0.03 or mean[1]*mean[1] > 0.03 or mean[2]*mean[2] > 0.03: exit(1) else: exit(0) diff --git a/tests/Disk/cyl_basis.py b/tests/Disk/cyl_basis.py index 227b22f4a..2d2b6e0d3 100644 --- a/tests/Disk/cyl_basis.py +++ b/tests/Disk/cyl_basis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 -import numpy as np +# import numpy as np import pyEXP # Make the disk basis config diff --git a/tests/Halo/check.py b/tests/Halo/check.py index 54a499349..d05381c3d 100644 --- a/tests/Halo/check.py +++ b/tests/Halo/check.py @@ -1,14 +1,22 @@ -import numpy as np +# Open the output log file +file = open("OUTLOG.run0") -# Read the output log file -data = np.loadtxt("OUTLOG.run0", skiprows=6, delimiter="|") +n = 0 # Count lines +mean = 0.0 # Accumulate 2T/VC values -# Column 16 is -2T/VC. The mean should be 1 -mean = np.mean(data[:,16]) -stdv = np.std (data[:,16]) +# Open the output log file +# +while (line := file.readline()) != "": + if n >= 6: # Skip the header stuff + v = [float(x) for x in line.split('|')] + mean += v[16] # This is the 2T/VC column + n = n + 1 # Count lines -# If the values are within 6 sigma of 1, assume that the simulation worked -if np.abs(mean - 1.0) > 6.0*stdv: +if n>6: mean /= n-6 # Sanity check + +# Check closeness to 1.0 +# +if (mean-1.0)*(mean-1.0) > 0.003: exit(1) else: exit(0) diff --git a/tests/Halo/sph_basis.py b/tests/Halo/sph_basis.py index 1cee5d8ac..e72ca54e5 100644 --- a/tests/Halo/sph_basis.py +++ b/tests/Halo/sph_basis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # coding: utf-8 -import numpy as np +# import numpy as np import pyEXP # Make the halo basis config