Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows double precision compilation #145

Merged
merged 4 commits into from
Feb 21, 2025
Merged
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
18 changes: 15 additions & 3 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
mpi: ["Yes", "No"]
mtln: ["Yes"]
hdf: ["Yes"]
double-precision: ["No"]

include:
- os: ubuntu-22.04
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,32 @@ 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)
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
)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DCompileWithDebug)
endif()

include("${CMAKE_CURRENT_SOURCE_DIR}/set_precompiled_libraries.cmake")

Expand Down
4 changes: 1 addition & 3 deletions src_main_pub/interpreta_switches.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
!

Expand Down
12 changes: 9 additions & 3 deletions src_main_pub/version.F90
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions test/smbjson/test_read_dielectricSlab.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions test/smbjson/test_read_thinSlot.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions testData/input_examples/dielectric_slab.fdtd.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions testData/input_examples/thinSlot.fdtd.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down