Prebuilt binares are available at releases.
In windows, you need to install intel oneapi runtime libraries.
It is important to point out the repository has dependencies which are available as submodules. It is necessary to run git submodule init
and git submodule update
from the root folder before running any cmake
or build
commands.
If you use intel oneapi compiler, make sure to run
source /opt/intel/oneapi/compiler/latest/env/vars.sh
export FC=ifx
export CC=icx
export CXX=icpx
HDF5 precompiled libraries for ubuntu are used by default (see precompiled libraries cmake script).
You can compile HDF5 for your specific platform downloading the latest sources from this link. Extract to a folder and build and install with the following commands
cmake -S . -B build -DHDF5_BUILD_FORTRAN=YES -DHDF5_ENABLE_Z_LIB_SUPPORT=NO --fresh
cmake --build build -j
cmake --install build --prefix ~/hdf5-installed
A specific HDF5 library can be set with the option -DHDF5_ROOT=<path-to-library>
, e.g.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DHDF5_ROOT=~/hdf5-installed -DHDF5_USE_STATIC_LIBRARIES=TRUE --fresh
cmake --build build -j
MTLN depends on lapack
and ngspice
. Precompiled versions are included for windows (intelLLVM) and ubuntu (intelLLVM and GNU).
For other platform/compilers these will need to be compiled.
In linux, when using some of the provided scripts you may find problems with carriage returns. These can be fixed with:
sed -i -e 's/\r$//' compile_linux.sh
sed -i -e 's/\r$//' autogen.sh
find . -name \*.m4|xargs dos2unix\nfind . -name \*.ac|xargs dos2unix\nfind . -name \*.am|xargs dos2unix
the ngspice
static library can be compiled doing the following:
- Edit
configure.ac
, toAC_SUBST([STATIC], [-static])
- Edit
compile_linux_shared.sh
, to
libngspice_la_CFLAGS = -static
libngspice_la_LDFLAGS = -static -version-info @LIB_VERSION@
If you use intel oneapi, make sure to load the mpi environment variables:
source /opt/intel/oneapi/mpi/latest/env/vars.sh
Clone this repository:
git clone https://github.com/OpenSEMBA/fdtd.git
or, if using SSH keys:
git clone [email protected]:OpenSEMBA/fdtd.git
navigate to the /fdtd/
folder that has been created, this folder will be referred to as root
for any future purposes.
This compilation process will use the already available precompiled libraries included with the project, thus it's not required to build them manually.
This repository has dependencies that are available as submodules. It is necessary to run git submodule init
and git submodule update
from the root folder before running any cmake
or build
commands.
In the .gitmodules file, the submodules use the SSH remote URL by default. If not using a SSH-key in the computer where the following process will be performed, the remote addresses for each submodule must be individually changed to their HTTPS alternative.
This software requires Windows BaseKit and Windows HPCKit. Install these packages with all their features selected.
Additionally, if not done already, install CMake and Ninja, follow their respective installation steps.
Open a command prompt with OneAPI variables initialised, to do this open a new command prompt and type:
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64
This will load the OneAPI environment for x64.
Navigate to the fdtd root folder, choose between "Debug"/"Release" for -DCMAKE_BUILD_TYPE
, and "Yes"/"No" for -DSEMBA_FDTD_ENABLE_MPI
, for example, a Release version with MPI Support would be:
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DSEMBA_FDTD_ENABLE_MPI=Yes
Then,
cmake --build build -j
We should now find the compiled executables in \build\bin\
.
In order to use semba-fdtd, the executable must have access to the dynamic libraries it has dependencies on. Either move the libraries to the same folder as the executable, or run the executable through a console with the OneAPI environment loaded:
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64
Once the environment is loaded, follow the steps in the next section.
-
Install necessary tools:
- Install Intel Base Kit and Intel HPC Kit.
- Install Visual Studio 2019. This must be done after the intel Intel compilers. Visual Studio 2022 is not supported (as of Oct. 2024).
- Ensure CMake is installed. It's recommended to use CMake GUI to simplify configuration on Windows.
-
Generate the Project with CMake GUI:
- In CMake GUI, select the option to create a project for Visual Studio 2019 from the CMake files.
- Set
-T fortran=ifx
to use intelLLVM compiler. - Specify the output folder where the
.sln
file for the project will be generated.
-
Open the Project in Visual Studio:
- Open the generated
.sln
file in Visual Studio 2019. - You will see multiple projects in the solution, one for each library and executable.
- Open the generated
-
Compilation Configuration:
- You may encounter specific errors in the fdtd-tests projects during compilation, particularly related to the
/Mtd
or/MD
options. - To resolve this issue:
- Right-click on the problematic project (
fdtd_tests
) and select Properties. - Go to Code Generation and change the corresponding option to
/Mtd
.
- Right-click on the problematic project (
- You may encounter specific errors in the fdtd-tests projects during compilation, particularly related to the
-
Set the Main Project:
- Select the
semba-fdtd
project and set it as the main project.
- Select the
-
Debugger Configuration:
- In the project properties, go to the Debugger section.
- Configure the following parameters:
- Working Directory: Set the working directory based on the case you want to debug.
- Command Arguments: Enter
-i filename
(wherefilename
is the required input file).
-
Debug the Project:
- Launch the project by pressing F5 to begin debugging.
Following these steps, the project should be set up and ready to compile and debug in Visual Studio 2019 with Intel tools.
- Windows 10 (version 1903 or higher) or Windows 11
- WSL2 installed
- Visual Studio Code (VSCode) installed on Windows
- Open PowerShell as Administrator and run the following command to enable the required features:
wsl --install
wsl --set-default-version 2
- After installation is complete, you can choose a Linux distribution from the Microsoft Store (e.g., Ubuntu). for example if you want to install Ubuntu:
wsl --install -d Ubuntu-24.04
- Launch the installed distribution from the Start menu, and it will complete the installation by setting up a user.
Go to the official Visual Studio Code website and download the installer: https://code.visualstudio.com/
Once downloaded, double-click the installer and follow the on-screen instructions to complete the installation.
After the installation is complete, you can open Visual Studio Code either by:
- Searching for "Visual Studio Code" in the Start Menu
- Or by launching the VSCode application from the shortcut created during installation.
To work with these project is mandatory to install the next extensions
- Modern Fortran (Fortran development)
- Python (Python development)
- C/C++ (C/C++ development)
- CMake (CMake integration)
- C++ TestMate (C++ testing)
- Remote - WSL
After installing the Remote - WSL extension, follow these steps to open VSCode in the WSL2 environment:
- Press Ctrl + Shift + P to open the Command Palette.
- Type
Remote-WSL: New Window
and press Enter. - VSCode will open a new window and connect to your default WSL2 distribution.
Now you're set up to work with your WSL2 environment directly from VSCode
Now we are ready to clone the repo
git clone <repository_url>
cd <repository_name>
This project has submodule dependencies remember to initiate an update the
git submodule init
git submodule update
If the project has Python dependencies listed in a requirements.txt file, you can install them using the following command:
- Make sure you have Python and pip installed on your system. It is recomended to use a venv.
- Run the following command to install the required dependencies:
python3 -m pip install -r requirements.txt
It is needed to install manually the hdf5 dependencies. On the terminal type the next command:
sudo apt install libhdf5-dev libopenmpi-dev
Now, you need to build the project using CMake.
-
Open the Command Palette in Visual Studio Code by pressing Ctrl + Shift + P.
-
Type CMake: Build and select it from the list of commands.
This will trigger the build process using the current CMake configuration.
If you want to modify the CMake settings (such as build options or configurations), follow these steps:
-
Open the Command Palette in Visual Studio Code by pressing Ctrl + Shift + P.
-
Type CMake: Configure and select it from the list of commands.
This will open the CMake configuration interface where you can modify build settings.
-
After making any changes to the settings, rebuild the project by running the CMake: Clean Rebuild command again from the Command Palette.
To run Python unit tests, you need to configure the testing framework.
- Open the Command Palette in Visual Studio Code by pressing Ctrl + Shift + P.
- Type Python: Configure Tests and select it from the list of commands.
- When prompted, select unittest as the testing framework.
- Select the folder containing your test files. Typically, this folder is named tests or something similar. Once selected, Visual Studio Code will automatically configure and discover the tests.
To run the tests:
- Open the Command Palette again by pressing Ctrl + Shift + P.
- Type Python: Run All Tests to run the unit tests in your project.
For a correct debugging experience is needed to configure a launch.json file. This file usually is created by vscode automatically. In case it does not exist. You can create your own on .vscode folder.
An example of launch.json filke is given. This will use a file as argument when calling to semba-fdtd.
{
"version": "0.2.0",
"configurations": [
{
"name": "Fortran Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/bin/semba-fdtd",
"miDebuggerPath": "gdb",
"args": ["-i", "shieldingEffectiveness.fdtd.json"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}/tmp_cases/sgbcShieldingEffectiveness/"
}
]
}
Now you are ready to work with the project.