From 22051bc60e3ef187058d6311e4a3358333d9f2b6 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Thu, 20 Feb 2025 11:56:13 +0100 Subject: [PATCH 1/4] Allows double precision compilation --- .github/workflows/ubuntu.yml | 18 +++++++++++++++--- .github/workflows/windows.yml | 6 ++++-- CMakeLists.txt | 13 +++++++++---- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c487e9b0..8cb5197f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -24,6 +24,7 @@ jobs: mpi: ["Yes", "No"] mtln: ["Yes"] hdf: ["Yes"] + double-precision: ["No"] include: - os: ubuntu-22.04 @@ -32,18 +33,28 @@ jobs: mpi: "No" mtln: "No" hdf: "Yes" + double-precision: "No" + - os: ubuntu-latest compiler: {name: 'nvidia-hpc', version: '24.5'} build-type: "Release" mpi: "No" mtln: "No" hdf: "No" - + double-precision: "No" + + - os: ubuntu-latest + compiler: {name: 'intel', version: '2024.2'} + build-type: "Release" + mpi: "Yes" + mtln: "No" + hdf: "Yes" + double-precision: "Yes" fail-fast: false runs-on: ${{ matrix.os }} - name: ${{matrix.os}} / ${{matrix.compiler.name}} / ${{matrix.build-type}}-mpi(${{matrix.mpi}})-mtln(${{matrix.mtln}})-hdf(${{matrix.hdf}}) + name: ${{matrix.os}} / ${{matrix.compiler.name}} / ${{matrix.build-type}}-mpi(${{matrix.mpi}})-mtln(${{matrix.mtln}})-hdf(${{matrix.hdf}})-double(${{matrix.double-precision}}) steps: - name: Checkout @@ -80,7 +91,8 @@ jobs: -DCMAKE_BUILD_TYPE=${{matrix.build-type}} \ -DSEMBA_FDTD_ENABLE_MPI=${{matrix.mpi}} \ -DSEMBA_FDTD_ENABLE_HDF=${{matrix.hdf}} \ - -DSEMBA_FDTD_ENABLE_MTLN=${{matrix.mtln}} + -DSEMBA_FDTD_ENABLE_MTLN=${{matrix.mtln}} \ + -DSEMBA_FDTD_ENABLE_DOUBLE_PRECISION=${{matrix.double-precision}} cmake --build build -j - name: Run unit tests diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 51c9cfc0..5b0d7827 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -23,11 +23,12 @@ jobs: mpi: ["No"] mtln: ["Yes"] hdf: ["Yes"] + double-precision: ["Yes", "No"] fail-fast: false runs-on: ${{matrix.os}} - name: ${{matrix.os}} / ${{matrix.compiler.name}} / ${{matrix.build-type}}-mpi(${{matrix.mpi}})-mtln(${{matrix.mtln}})-hdf(${{matrix.hdf}}) + name: ${{matrix.os}} / ${{matrix.compiler.name}} / ${{matrix.build-type}}-mpi(${{matrix.mpi}})-mtln(${{matrix.mtln}})-hdf(${{matrix.hdf}})-double(${{matrix.double-precision}}) steps: @@ -61,7 +62,8 @@ jobs: -DCMAKE_BUILD_TYPE=${{matrix.build-type}} \ -DSEMBA_FDTD_ENABLE_MPI=${{matrix.mpi}} \ -DSEMBA_FDTD_ENABLE_HDF=${{matrix.hdf}} \ - -DSEMBA_FDTD_ENABLE_MTLN=${{matrix.mtln}} + -DSEMBA_FDTD_ENABLE_MTLN=${{matrix.mtln}} \ + -DSEMBA_FDTD_ENABLE_DOUBLE_PRECISION=${{matrix.double-precision}} cmake --build build -j - name: Run unit tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e2e2894..25c49374 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,12 +15,13 @@ option(SEMBA_FDTD_ENABLE_MPI "Use MPI" OFF) option(SEMBA_FDTD_ENABLE_HDF "Use HDF" ON) option(SEMBA_FDTD_ENABLE_MTLN "Use MTLN" ON) option(SEMBA_FDTD_ENABLE_SMBJSON "Use smbjson" ON) +option(SEMBA_FDTD_ENABLE_DOUBLE_PRECISION "Use double precision (CompileWithReal8)" OFF) option(SEMBA_FDTD_ENABLE_TEST "Compile tests" ON) option(SEMBA_FDTD_EXECUTABLE "Compiles executable" ON) -option(SEMBA_FDTD_MAIN_LIB "Compiles main library" ON) -option(SEMBA_FDTD_COMPONENTS_LIB "Compiles components library" ON) -option(SEMBA_FDTD_OUTPUTS_LIB "Compiles outputs library" ON) +option(SEMBA_FDTD_MAIN_LIB "Compiles main library" ON) +option(SEMBA_FDTD_COMPONENTS_LIB "Compiles components library" ON) +option(SEMBA_FDTD_OUTPUTS_LIB "Compiles outputs library" ON) if(SEMBA_FDTD_ENABLE_SMBJSON) add_definitions(-DCompileWithSMBJSON) @@ -28,9 +29,13 @@ endif() if (SEMBA_FDTD_ENABLE_MTLN) add_definitions(-DCompileWithMTLN) endif() +if (SEMBA_FDTD_ENABLE_DOUBLE_PRECISION) + add_definitions(-DCompileWithReal8) +else() + add_definitions(-DCompileWithReal4) +endif() add_definitions( -DCompileWithInt2 - -DCompileWithReal4 -DCompileWithOpenMP ) From ae315722682b571a68dad05344ed5c68b6a27eb8 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Fri, 21 Feb 2025 09:35:02 +0100 Subject: [PATCH 2/4] changes PML to Mur in some tests --- test/smbjson/test_read_dielectricSlab.F90 | 4 ++-- test/smbjson/test_read_thinSlot.F90 | 4 ++-- testData/input_examples/dielectric_slab.fdtd.json | 4 ++-- testData/input_examples/thinSlot.fdtd.json | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/smbjson/test_read_dielectricSlab.F90 b/test/smbjson/test_read_dielectricSlab.F90 index e3fea572..56add64d 100644 --- a/test/smbjson/test_read_dielectricSlab.F90 +++ b/test/smbjson/test_read_dielectricSlab.F90 @@ -54,8 +54,8 @@ function expectedProblemDescription() result (expected) expected%front%tipoFrontera(F_XU) = F_PEC expected%front%tipoFrontera(F_YL) = F_PMC expected%front%tipoFrontera(F_YU) = F_PMC - expected%front%tipoFrontera(F_ZL) = F_PML - expected%front%tipoFrontera(F_ZU) = F_PML + expected%front%tipoFrontera(F_ZL) = F_MUR + expected%front%tipoFrontera(F_ZU) = F_MUR ! Expected sources. allocate(expected%plnSrc%collection(1)) diff --git a/test/smbjson/test_read_thinSlot.F90 b/test/smbjson/test_read_thinSlot.F90 index 509a54de..cf925624 100644 --- a/test/smbjson/test_read_thinSlot.F90 +++ b/test/smbjson/test_read_thinSlot.F90 @@ -54,8 +54,8 @@ function expectedProblemDescription() result (expected) expected%front%tipoFrontera(F_XU) = F_PER expected%front%tipoFrontera(F_YL) = F_PER expected%front%tipoFrontera(F_YU) = F_PER - expected%front%tipoFrontera(F_ZL) = F_PML - expected%front%tipoFrontera(F_ZU) = F_PML + expected%front%tipoFrontera(F_ZL) = F_MUR + expected%front%tipoFrontera(F_ZU) = F_MUR ! Expected sources. allocate(expected%plnSrc%collection(1)) diff --git a/testData/input_examples/dielectric_slab.fdtd.json b/testData/input_examples/dielectric_slab.fdtd.json index 5508eccd..13bfdcd5 100644 --- a/testData/input_examples/dielectric_slab.fdtd.json +++ b/testData/input_examples/dielectric_slab.fdtd.json @@ -12,8 +12,8 @@ "xUpper": {"type": "pec"}, "yLower": {"type": "pmc"}, "yUpper": {"type": "pmc"}, - "zLower": {"type": "pml"}, - "zUpper": {"type": "pml"} + "zLower": {"type": "mur"}, + "zUpper": {"type": "mur"} }, "mesh": { diff --git a/testData/input_examples/thinSlot.fdtd.json b/testData/input_examples/thinSlot.fdtd.json index 2990fe2a..6836909c 100644 --- a/testData/input_examples/thinSlot.fdtd.json +++ b/testData/input_examples/thinSlot.fdtd.json @@ -12,8 +12,8 @@ "xUpper": {"type": "periodic"}, "yLower": {"type": "periodic"}, "yUpper": {"type": "periodic"}, - "zLower": {"type": "pml"}, - "zUpper": {"type": "pml"} + "zLower": {"type": "mur"}, + "zUpper": {"type": "mur"} }, "mesh": { From 5cbb3a8d5f3a1392afb88066661d4048a78b8c67 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Fri, 21 Feb 2025 10:08:17 +0100 Subject: [PATCH 3/4] Adds debug compilation mode info --- CMakeLists.txt | 3 +++ src_main_pub/version.F90 | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c49374..6ba51f41 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,9 @@ add_definitions( -DCompileWithInt2 -DCompileWithOpenMP ) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DCompileWithDebug) +endif() include("${CMAKE_CURRENT_SOURCE_DIR}/set_precompiled_libraries.cmake") diff --git a/src_main_pub/version.F90 b/src_main_pub/version.F90 index 788acc96..1661bac6 100755 --- a/src_main_pub/version.F90 +++ b/src_main_pub/version.F90 @@ -1,5 +1,11 @@ module version -character (128), parameter :: compdate= __DATE__ // " " // __TIME__ -character(128), parameter :: dataversion=& -'SEMBA-FDTD Version v1.0. Compiled on: ' // trim(adjustl(compdate)) + character(128), parameter :: compilation_date= __DATE__ // " " // __TIME__ +#ifdef CompileWithDebug + character(128), parameter :: compilation_mode='Debug build' +#else + character(128), parameter :: compilation_mode='Release build' +#endif + character(128), parameter :: dataversion = & + 'SEMBA-FDTD. '// trim(adjustl(compilation_mode)) // & + ', compiled on: ' // trim(adjustl(compilation_date)) end module version From 005e80f4c28903640a3ec403c3fd2e1b3c2d1136 Mon Sep 17 00:00:00 2001 From: Luis Manuel Diaz Angulo Date: Fri, 21 Feb 2025 10:26:54 +0100 Subject: [PATCH 4/4] Minor --- src_main_pub/interpreta_switches.F90 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src_main_pub/interpreta_switches.F90 b/src_main_pub/interpreta_switches.F90 index 94b82724..7cf3fdc3 100755 --- a/src_main_pub/interpreta_switches.F90 +++ b/src_main_pub/interpreta_switches.F90 @@ -253,8 +253,7 @@ subroutine interpreta(l,statuse) l%opcionespararesumeo = trim (adjustl(l%opcionespararesumeo)) // ' ' // trim (adjustl(l%chain)) // ' ' // trim (adjustl(f)) mpidirset=.true. endif - -!!!!!!!#ifndef CompileWithGamusino + case ('-pause') i = i + 1 CALL getcommandargument (l%chaininput, i, f, l%length, statuse) @@ -369,7 +368,6 @@ subroutine interpreta(l,statuse) CASE ('-clip') l%CLIPREGION = .TRUE. l%opcionespararesumeo = trim (adjustl(l%opcionespararesumeo)) // ' ' // trim (adjustl(l%chain)) -!endif del compileWithGamusino !!!!#endif !