Skip to content

Commit 27497f3

Browse files
authored
Add build test workflow (#2)
This commit adds a workflow to test that built assets are able to run on an isolated target system. Some bug fixes were also applied to get the tests passing: + Added static linking for Intel libraries for Linux executables + Improved method for reading meshfile path from Nemoh.cal file Some other changes include: + Removing caching of oneAPI on Windows action runners as the Visual Studio integration was not preserved + Added an example of an interacting heaving cube
1 parent a90cb9e commit 27497f3

File tree

10 files changed

+192
-41
lines changed

10 files changed

+192
-41
lines changed

.github/scripts/cache_exclude_windows.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/build_test.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Test Build Assets
2+
on:
3+
push:
4+
branches:
5+
- velocity_potential_over_cylinder
6+
pull_request:
7+
branches:
8+
- velocity_potential_over_cylinder
9+
10+
env:
11+
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/a37c30c3-a846-4371-a85d-603e9a9eb94c/intel-oneapi-hpc-toolkit-2025.0.1.48_offline.exe
12+
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
13+
LINUX_FORTRAN_COMPONENTS: intel-oneapi-compiler-fortran
14+
15+
jobs:
16+
linux:
17+
runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
shell: bash
21+
steps:
22+
- name: Setup | Checkout repository at workflow sha
23+
uses: actions/checkout@v4
24+
- name: Setup | Setup apt repo
25+
run: .github/scripts/setup_apt_repo_linux.sh
26+
- name: Cache | Collect versioned dependencies of apt packages
27+
run: .github/scripts/apt_depends.sh $LINUX_FORTRAN_COMPONENTS | tee depends.txt
28+
- name: Cache | Install
29+
id: cache-install
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
/opt/intel/oneapi/compiler
34+
key: install-${{ env.LINUX_FORTRAN_COMPONENTS }}-${{ hashFiles('**/depends.txt') }}-compiler-${{ hashFiles('**/.github/scripts/cache_exclude_linux.sh') }}
35+
- name: Intel Fortran Install
36+
if: steps.cache-install.outputs.cache-hit != 'true'
37+
run: .github/scripts/install_linux_apt.sh $LINUX_FORTRAN_COMPONENTS
38+
- name: Build
39+
run: .github/scripts/build_linux.sh
40+
- name: Tar files
41+
run: tar -cvf nemoh.tar bin
42+
- uses: actions/upload-artifact@v4
43+
with:
44+
name: nemoh-linux
45+
path: nemoh.tar
46+
- name: Exclude unused files from cache
47+
if: steps.cache-install.outputs.cache-hit != 'true'
48+
run: .github/scripts/cache_exclude_linux.sh
49+
50+
linux-test:
51+
needs: linux
52+
runs-on: ubuntu-latest
53+
defaults:
54+
run:
55+
shell: bash
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/download-artifact@v4
59+
with:
60+
name: nemoh-linux
61+
- name: Untar files
62+
run: tar -xf nemoh.tar
63+
- name: Test
64+
run: |
65+
$GITHUB_WORKSPACE/bin/preProc
66+
$GITHUB_WORKSPACE/bin/solver
67+
$GITHUB_WORKSPACE/bin/postProc
68+
working-directory: ./Examples/InteractingCube
69+
70+
windows:
71+
runs-on: windows-latest
72+
defaults:
73+
run:
74+
shell: bash
75+
steps:
76+
- name: Setup | Checkout repository at workflow sha
77+
uses: actions/checkout@v4
78+
- name: Intel Fortran Install
79+
run: .github/scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS
80+
- name: Build
81+
run: .github/scripts/build_windows.bat
82+
- uses: actions/upload-artifact@v4
83+
with:
84+
name: nemoh-win64
85+
path: x64
86+
87+
windows-test:
88+
needs: windows
89+
runs-on: windows-latest
90+
defaults:
91+
run:
92+
shell: bash
93+
steps:
94+
- uses: actions/checkout@v4
95+
- uses: actions/download-artifact@v4
96+
with:
97+
name: nemoh-win64
98+
path: x64
99+
- name: Test
100+
run: |
101+
$GITHUB_WORKSPACE/x64/Release/preProcessor.exe
102+
$GITHUB_WORKSPACE/x64/Release/Solver.exe
103+
$GITHUB_WORKSPACE/x64/Release/postProcessor.exe
104+
working-directory: ./Examples/InteractingCube

.github/workflows/release.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ env:
99
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/a37c30c3-a846-4371-a85d-603e9a9eb94c/intel-oneapi-hpc-toolkit-2025.0.1.48_offline.exe
1010
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
1111
LINUX_FORTRAN_COMPONENTS: intel-oneapi-compiler-fortran
12-
CACHE_NUMBER: 5
1312

1413
jobs:
1514
linux:
16-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-latest
1716
defaults:
1817
run:
1918
shell: bash
@@ -53,16 +52,7 @@ jobs:
5352
steps:
5453
- name: Setup | Checkout repository at workflow sha
5554
uses: actions/checkout@v4
56-
- name: Cache | Install
57-
id: cache-install
58-
uses: actions/cache@v3
59-
with:
60-
path: |
61-
C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat
62-
C:\Program Files (x86)\Intel\oneAPI\compiler
63-
key: install-${{ env.CACHE_NUMBER }}-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_FORTRAN_COMPONENTS }}-compiler-${{ hashFiles('**/.github/scripts/cache_exclude_windows.sh') }}
6455
- name: Intel Fortran Install
65-
if: steps.cache-install.outputs.cache-hit != 'true'
6656
run: .github/scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS
6757
- name: Build
6858
run: .github/scripts/build_windows.bat
@@ -71,7 +61,3 @@ jobs:
7161
gh release upload ${{github.event.release.tag_name}} nemoh-win64-${{ github.event.release.tag_name }}.zip
7262
env:
7363
GITHUB_TOKEN: ${{ github.TOKEN }}
74-
- name: Exclude unused files from cache
75-
if: steps.cache-install.outputs.cache-hit != 'true'
76-
shell: bash
77-
run: .github/scripts/cache_exclude_windows.sh

Examples/InteractingCube/ID.dat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1
2+
.

Examples/InteractingCube/Nemoh.cal

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--- Environment ------------------------------------------------------------------------------------------------------------------
2+
1025.00 ! RHO ! KG/M**3 ! Fluid specific volume
3+
9.82 ! G ! M/S**2 ! Gravity
4+
50.0 ! DEPTH ! M ! Water depth
5+
0. 0. ! XEFF YEFF ! M ! Wave measurement point
6+
--- Description of floating bodies -----------------------------------------------------------------------------------------------
7+
1 ! Number of bodies
8+
--- Body [0] ----------------------------------------------
9+
./mesh/cube.dat ! Name of mesh file
10+
20 5 ! Number of points and number of panels
11+
1 ! Number of degrees of freedom
12+
1 0 0 1 0 0 0 ! DOF type(1x1) direction(3x1) position(3x1)
13+
1 ! Number of generalised forces
14+
1 0 0 1 0 0 0 ! DOF type(1x1) direction(3x1) position(3x1)
15+
0 ! Number of lines of additional information
16+
--- Load cases to be solved -------------------------------------------------------------------------------------------------------
17+
10.0 0.1 1.1 ! Number of wave frequencies, Min, and Max (rad/s)
18+
1 0.0 0.0 ! Number of wave angles, Min, and Max (deg)
19+
--- Post processing ---------------------------------------------------------------------------------------------------------------
20+
0 0.01 10. ! IRF ! IRF calculation (0 for no calculation), time step and duration
21+
0 ! Show pressure
22+
0 0. 180. ! Kochin function ! Number of directions of calculation (0 for no calculations), Min and Max (degrees)
23+
0 2 1000. 2. ! Free surface elevation ! Number of points in x direction (0 for no calcutions) and y direction and dimensions of domain in x and y direction
24+
3.414213562373095 10 10 ! Cylindrical surface ! Radius (0 for no calc), Number of points in theta direction, Number of points in z direction
25+
--- End of file -------------------------------------------------------------------------------------------------------------------

Examples/InteractingCube/input.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--- Calculation parameters ------------------------------------------------------------------------------------
2+
0 ! Indiq_solver ! - ! Solver (0) Direct Gauss (1) GMRES (2) GMRES with FMM acceleration (2 not implemented yet)
3+
20 ! IRES ! - ! Restart parameter for GMRES
4+
5.E-07 ! TOL_GMRES ! - ! Stopping criterion for GMRES
5+
100 ! MAXIT ! - ! Maximum iterations for GMRES
6+
1 ! Sav_potential ! - ! Save potential for visualization
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2 0
2+
1 1.000000 -1.000000 0.000000
3+
2 -1.000000 -1.000000 0.000000
4+
3 -1.000000 -1.000000 -2.000000
5+
4 1.000000 -1.000000 -2.000000
6+
5 -1.000000 -1.000000 0.000000
7+
6 -1.000000 1.000000 0.000000
8+
7 -1.000000 1.000000 -2.000000
9+
8 -1.000000 -1.000000 -2.000000
10+
9 -1.000000 1.000000 0.000000
11+
10 1.000000 1.000000 0.000000
12+
11 1.000000 1.000000 -2.000000
13+
12 -1.000000 1.000000 -2.000000
14+
13 1.000000 1.000000 0.000000
15+
14 1.000000 -1.000000 0.000000
16+
15 1.000000 -1.000000 -2.000000
17+
16 1.000000 1.000000 -2.000000
18+
17 1.000000 1.000000 -2.000000
19+
18 1.000000 -1.000000 -2.000000
20+
19 -1.000000 -1.000000 -2.000000
21+
20 -1.000000 1.000000 -2.000000
22+
0 0.000000 0.000000 0.000000
23+
1 2 3 4
24+
5 6 7 8
25+
9 10 11 12
26+
13 14 15 16
27+
17 18 19 20
28+
0 0 0 0

Examples/InteractingCube/results/.empty

Whitespace-only changes.

makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ endif
1515
ifeq ($(itest), ifx)
1616
FC=ifx
1717
FFLAGS=-c -cpp
18+
LDFLAGS=-static-intel
1819
endif
1920

2021
#SOURCES FORTRAN Mesh(modules de maillage)
@@ -150,29 +151,29 @@ bin:
150151
msh: mesh
151152
#Rules to Build MAIN EXECUTABLE (dependances et regle d'execution)
152153
mesh: $(OBJM)
153-
$(FC) -o $(outputdir)/mesh $(OBJM2)
154+
$(FC) $(LDFLAGS) -o $(outputdir)/mesh $(OBJM2)
154155
#
155156
#Build preProc executable
156157
pre: preProc
157158
#Rules to Build MAIN EXECUTABLE (dependances et regle d'execution)
158159
preProc: $(OBJP)
159-
$(FC) -o $(outputdir)/preProc $(OBJP2)
160+
$(FC) $(LDFLAGS) -o $(outputdir)/preProc $(OBJP2)
160161

161162

162163
#
163164
#Build solver executable
164165
solver: Nemoh
165166
#Rules to Build MAIN EXECUTABLE (dependances et regle d'execution)
166167
Nemoh: $(OBJS)
167-
$(FC) -o $(outputdir)/solver $(OBJS2)
168+
$(FC) $(LDFLAGS) -o $(outputdir)/solver $(OBJS2)
168169

169170

170171
#
171172
#Build postProc executable
172173
post: postProc
173174
#Rules to Build MAIN EXECUTABLE (dependances et regle d'execution)
174175
postProc: $(OBJO)
175-
$(FC) -o $(outputdir)/postProc $(OBJO2)
176+
$(FC) $(LDFLAGS) -o $(outputdir)/postProc $(OBJO2)
176177

177178
# Rules for .f comiplation
178179
.f.o:

preProcessor/Mesh.f90

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
!--------------------------------------------------------------------------------------
22
!
3-
! Copyright 2014 Ecole Centrale de Nantes, 1 rue de la Noë, 44300 Nantes, France
3+
! Copyright 2014 Ecole Centrale de Nantes, 1 rue de la Noë, 44300 Nantes, France
44
!
55
! Licensed under the Apache License, Version 2.0 (the "License");
66
! you may not use this file except in compliance with the License.
@@ -157,13 +157,25 @@ SUBROUTINE ReadTMesh(Mesh,ID)
157157
READ(10,*)
158158
READ(10,*)
159159
READ(10,*)
160-
READ(10,*)
160+
READ(10,*)
161161
DO c=1,Nbodies
162-
READ(10,*) meshfile
163-
tX=0.
164-
tY=0.
165-
READ(10,*) meshfile
166-
lfile=LNBLNK(meshfile)
162+
READ(10,*)
163+
READ(10,'(A)') meshfile
164+
165+
! Isolate the path part of the meshfile string
166+
lfile = SCAN(meshfile, '!') ! Comments
167+
IF (lfile > 1) THEN
168+
meshfile = meshfile(1:lfile-1)
169+
END IF
170+
171+
lfile = SCAN(meshfile, ACHAR(9) ) ! Tabs
172+
IF (lfile > 1) THEN
173+
meshfile = meshfile(1:lfile-1)
174+
END IF
175+
176+
meshfile = TRIM(meshfile) ! Whitespace
177+
178+
lfile = LNBLNK(meshfile)
167179
OPEN(11,FILE=meshfile(1:lfile))
168180
READ(11,*) M,N
169181
IF ((c.GT.1).AND.(N.NE.Mesh%Isym)) THEN
@@ -173,6 +185,8 @@ SUBROUTINE ReadTMesh(Mesh,ID)
173185
Mesh%Isym=N
174186
END IF
175187
READ(10,*) M,N
188+
tX=0.
189+
tY=0.
176190
DO i=1,M
177191
READ(11,*) d,(Mesh%X(j,Npoints+i),j=1,3)
178192
Mesh%X(1,Npoints+i)=Mesh%X(1,Npoints+i)+tX

0 commit comments

Comments
 (0)