Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# test based on ChatGPT's suggestion
name: CI

on: [push, pull_request] # run for every push & PR

jobs:
tests:
runs-on: ubuntu-latest # GitHub-hosted Linux runner

steps:
# 1️⃣ Bring the source onto the runner
- name: Check out code
uses: actions/checkout@v4

# 2️⃣ System packages for build & tests
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential gfortran make \
libfftw3-dev liblapack-dev \
python3 python3-numpy

# 3️⃣ Compile the QDyn executable (bin ends up in src/qdyn)
- name: Build qdyn
run: |
make -C src clean
make -C src \
LIBS="-lfftw3 -lm -llapack" # override local path in Makefile

# 4️⃣ Run the full regression-test suite
- name: Run test suite
run: |
cd tests
bash run_test_suite.sh | tee ../test_output.log

# 5️⃣ Fail the workflow if any test reported an error
- name: Check for test failures
run: |
if grep "ERROR found" test_output.log; then
echo "Some tests failed — see log above."
exit 1
fi
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Test QDyn
# Suggestion from ChatGPT

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3

# Install dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gfortran make wget tar

# Download, build, and install FFTW library
- name: Build and install FFTW
run: |
# Specify the FFTW version
FFTW_VERSION=3.3.10
wget http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz
tar -xzf fftw-${FFTW_VERSION}.tar.gz
cd fftw-${FFTW_VERSION}
./configure --enable-shared --prefix=/usr/local
make -j$(nproc)
sudo make install
cd ..

# Build the project using make
- name: Build the project
run: make

# Run tests using make
- name: Run tests
run: make tests
65 changes: 65 additions & 0 deletions .github/workflows/test_v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:

permissions:
contents: read

env:
FORCE_COLOR: 1

jobs:
intel_build:
name: Intel OneAPI build
runs-on: ubuntu-20.04
env:
FC: mpiifort
APT_PACKAGES: >-
intel-oneapi-compiler-fortran
intel-oneapi-mpi
intel-oneapi-mpi-devel

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

# - name: Install fftw
# run: |
# echo "Entering FFTW folder"
# cd fftw
# echo "Unpacking FFTW"
# tar -xf fftw.tar.gz
# echo "Compiling FFTW"
# cd fftw
# bash compile.sh

- name: Add Intel repository
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update

- name: Install Intel oneAPI compiler
run: |
sudo apt-get install ${{ env.APT_PACKAGES }}
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV

- name: Install fftw & build QDyn
run: |
echo "Entering FFTW folder"
cd fftw
echo "Unpacking FFTW"
tar -xf fftw.tar.gz
echo "Compiling FFTW"
cd fftw
bash compile.sh
echo "Compile QDyn"
cd ../../src
make clean && make
Binary file modified fftw/fftw.tar.gz
Binary file not shown.
12 changes: 8 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
# Compiler
FC = gfortran
FFLAGS =
#FFTW library needed
# LIBS = -L/home/janos/Programs/fftw/fftw-3.3.10/lib -lfftw3 -lm -llapack
# LIBS = -L/Users/janosj/Documents/Programs/fftw/fftw-3.3.10/lib -lfftw3 -lm
# FFTW library needed
LIBS = -L/Users/janosj/Documents/Programs/fftw/fftw-3.3.10/lib -lfftw3 -lm -llapack
LDLIBS = -lfftw3 # This is necessary only on clusters, not on MacOS

# for Github tests, I use different fftw library path
GitHub_LIBS = -L/usr/local/lib -lfftw3 -lm -llapack

# Name of program
OUT = qdyn

Expand All @@ -18,7 +19,10 @@ OUT = qdyn
OBJS = vars.o fparser.o fftw.o utils.o init.o propag.o qdyn.o

myprogram: $(OBJS)
$(FC) -o $(OUT) ${LIBS} ${FFLAGS} $(OBJS) ${LDLIBS}
$(FC) -o $(OUT) ${FFLAGS} $(OBJS) ${LIBS} ${LDLIBS}

github-build: $(OBJS)
$(FC) -o $(OUT) ${GitHub_LIBS} ${FFLAGS} $(OBJS) ${LDLIBS}

clean:
/bin/rm -f *.o *.mod $(OUT)
Expand Down
Loading