Skip to content

msolanik/Geliosphere

Repository files navigation

Geliosphere

Geliosphere is application that utilize GPU as a computing unit for cosmic ray modulation in Heliosphere. Contains 1D models of cosmic ray modulation in heliosphere based on this paper.

Class documentation can be found here.

Parameter Value Description
-F - Run forward-in-time simulation
-B - Run backward-in-time simulation
-E - Run SolarpropLike 2D backward-in-time simulation
-T - Run Geliosphere 2D backward-in-time simulation
-c - Set .csv output
-h - Print help for Geliosphere
-d float Set time step (default value 5.0s)
-K float Set K0 (default value 5∗10^22cm2/s)
-V float Set solar wind speed (default value 400 km/s)
-p string Set custom path for output in output directory
-N int Set amount of simulations in millions
-m int Set month for using meassured values
-y int Set year for using meassured values
-s string Set path to settings toml file (default Settings.tml in root folder)

All GPUs from Nvidia Pascal, Amphere, Volta and Turing architectures are supported.

Additional information about used models can be found in following articles:

Accuracy and comparasion results from GPU implementation to Crank-Nicolson model

Installation

Geliosphere with GPU support

Standard installation of the GPU version of Geliosphere requires installation of the Nvidia toolkit, g++ and cmake 3.14+. These packages can be installed via any packaging tool. The following example is provided for the apt-get packaging tool:

sudo apt-get install cuda g++ cmake

Different Linux distributions may have different approach for CUDA installation.

After installation is complete, an optimized version of the tool can be built via the following command:

cmake --clean-first -DCMAKE_BUILD_TYPE=Release --install ./ && make

After build is complete successfully, executable is placed in root directory with Geliosphere. For further instruction regarding the program usage, following command will display help for the user:

./Geliosphere --help

Geliosphere with CPU-only support

The packages are similar, with the exception that the CPU version naturally does not require installation of the Nvidia toolkit. CPU-only version of Geliosphere can be built via the following command:

cmake --clean-first -DCPU_VERSION_ONLY=1 -DCMAKE_BUILD_TYPE=Release --install ./ && make

Dockerized versions

We also included runner scripts(runner.sh and runner_cpu_only.sh), that can build and run Geliosphere in Docker. They automatically build Docker image, however it can re-built via:

./runner.sh -f
./runner_cpu_only.sh -f

Help for Geliosphere can be displayed via following command:

./runner.sh --help
./runner_cpu_only.sh --help

Module structure

Following image describes relations between modules in Geliosphere:

module_diagram drawio (1)

Modules are used to organize the logic needed for simulations in the heliosphere and to support logic for them. These modules are described as follows:

  • Geliosphere - contains the main function and links basic logic for selecting the model, parsing input data and running the selected model,
  • Algorithm - contains logic used for selecting implementation of model for selected computing unit, and logic for analyzing output spectra,
  • Factory - contains classes based on factory and abstract factory patterns used for creating objects,
  • Constants - contains classes used for parsing input data,
  • CPU Implementations - contains classes used for running parallel CPU implementations of models of cosmic rays modulation in the heliosphere,
  • CUDA Kernel - contains classes used for running parallel GPU implementations of models of cosmic rays modulation in the heliosphere,
  • Utils - contains classes holding various functions used in Geliosphere.

Source file description

Geliosphere module

Geliosphere
|
│    Dockerfile
|    Dockerfile.CPU  
|    main.cpp
└───Algorithm
└───Constants
└───CpuImplementations
└───CUDAKernel
└───Factory
└───Utils

Geliosphere module contains following source files:

  • Dockerfile - file containing defitinion for building GPU Docker image with GPU support.
  • Dockerfile.CPU - file containing defitinion for building GPU Docker image with CPU-only support.
  • main.cpp - file containing main functions with needed iteractions between modules.

Algorithm module

Algorithm
│    
└───include
|   |   AbstractAlgorithm.hpp
|   |   OneDimensionBpAlgorithm.hpp
|   |   OneDimensionBpResults.hpp
|   |   OneDimensionFpAlgorithm.hpp
|   |   OneDimensionFpResults.hpp
|   |   ResultConstants.hpp
|   |   ThreeDimensionBpAlgorithm.hpp
|   |   TwoDimensionBpAlgorithm.hpp
|   |   TwoDimensionBpResults.hpp
└───src
    |   AbstractAlgorithm.cpp
    |   OneDimensionBpAlgorithm.cpp
    |   OneDimensionBpResults.cpp
    |   OneDimensionFpAlgorithm.cpp
    |   OneDimensionFpResults.cpp
    |   ThreeDimensionBpAlgorithm.cpp
    |   TwoDimensionBpAlgorithm.cpp
    |   TwoDimensionBpResults.cpp

Algorithm module contains following source files:

  • AbstractAlgorithm.hpp - Header file of abstract definition for algorithm.

  • OneDimensionBpAlgorithm.hpp - Header file of implementation of 1D B-p method

  • OneDimensionBpResults.hpp - Header file of implementation of 1D B-p method analyzer for output data.

  • OneDimensionFpAlgorithm.hpp - Header file of implementation of 1D F-p method

  • OneDimensionFpResults.hpp - Header file of implementation of 1D F-p method analyzer for output data.

  • ResultConstants.hpp - Header file containing constants needed for analysis of log files for all models.

  • ThreeDimensionBpAlgorithm.hpp - Header file of implementation of Geliosphere 2D B-p method.

  • TwoDimensionBpAlgorithm.hpp - Header file of implementation of SolarProp-like 2D B-p method.

  • TwoDimensionBpResults.hpp - Header file of implementation of 2D B-p method analyzer for output data.

  • AbstractAlgorithm.cpp - Source file of abstract definition for algorithm.

  • OneDimensionBpAlgorithm.cpp - Source file of implementation of 1D B-p method

  • OneDimensionBpResults.cpp - Source file of implementation of 1D B-p method analyzer for output data.

  • OneDimensionFpAlgorithm.cpp - Source file of implementation of 1D F-p method

  • OneDimensionFpResults.cpp - Source file of implementation of 1D F-p method analyzer for output data.

  • ThreeDimensionBpAlgorithm.cpp - Source file of implementation of Geliosphere 2D B-p method.

  • TwoDimensionBpAlgorithm.cpp - Source file of implementation of SolarProp-like 2D B-p method.

  • TwoDimensionBpResults.cpp - Source file of implementation of 2D B-p method analyzer for output data.

Factory module

Factory
│    
└───include
|   |   AbstractAlgorithmFactory.hpp
|   |   CosmicFactory.hpp
└───src
    |   AbstractAlgorithmFactory.cpp
    |   CosmicFactory.cpp

Factory module contains following source files:

  • AbstractAlgorithmFactory.hpp - Interface of Abstract Factory Pattern.
  • CosmicFactory.hpp - Class represents implementation of Factory Pattern for cosmic algorithms.
  • AbstractAlgorithmFactory.cpp - Source file for interface of Abstract Factory Pattern.
  • CosmicFactory.cpp - Source file of class represents implementation of Factory Pattern for cosmic algorithms.

Constants module

Constants
│    
└───include
|   |   MeasureValuesTransformation.hpp
|   |   ParamsCarrier.hpp
|   |   ParseParams.hpp
|   |   TomlSettings.hpp
└───src
    |   MeasureValuesTransformation.cpp
    |   ParamsCarrier.cpp
    |   ParseParams.cpp
    |   TomlSettings.cpp

Constants module contains following source files:

  • MeasureValuesTransformation.hpp - Header file for class representing extraction of measured parameters for simulation from table.
  • ParamsCarrier.hpp - Header file for universal map-like structure.
  • ParseParams.hpp - Header file of parser of arguments from CLI
  • TomlSettings.hpp - Header file for class representing parser of values from settings.
  • MeasureValuesTransformation.cpp - Source file for class representing extraction of measured parameters for simulation from table.
  • ParamsCarrier.cpp - Source file for universal map-like structure.
  • ParseParams.cpp - Source file of parser of arguments from CLI
  • TomlSettings.cpp - Source file for class representing parser of values from settings.

CPU Implementations module

CpuImplementations
│    
└───include
|   |   AbstractCpuSimulation.hpp
|   |   Constants.hpp
|   |   OneDimensionBpCpuSimulation.hpp
|   |   OneDimensionFpCpuSimulation.hpp
|   |   ThreeDimensionBpCpuSimulation.hpp
|   |   TwoDimensionBpCpuSimulation.hpp
└───src
    |   OneDimensionBpCpuSimulation.cpp
    |   OneDimensionFpCpuSimulation.cpp
    |   ThreeDimensionBpCpuSimulation.cpp
    |   TwoDimensionBpCpuSimulation.cpp

CPU Implementations module contains following source files:

  • AbstractCpuSimulation.hpp - Abstract definition for implementation of model on CPU.

  • Constants.hpp - Header file for constants for CPU implementations.

  • OneDimensionBpCpuSimulation.hpp - Header file for CPU implementation for 1D B-p model.

  • OneDimensionFpCpuSimulation.hpp - Header file for CPU implementation for 1D F-p model.

  • ThreeDimensionBpCpuSimulation.hpp - Header file for CPU implementation for Geliosphere 2D B-p model.

  • TwoDimensionBpCpuSimulation.hpp - Header file for CPU implementation for SolarProp-like 2D B-p model.

  • OneDimensionBpCpuSimulation.cpp - Source file for CPU implementation for 1D B-p model.

  • OneDimensionFpCpuSimulation.cpp - Source file for CPU implementation for 1D F-p model.

  • ThreeDimensionBpCpuSimulation.cpp - Source file for CPU implementation for Geliosphere 2D B-p model.

  • TwoDimensionBpCpuSimulation.cpp - Source file for CPU implementation for SolarProp-like 2D B-p model.

CUDA Kernel module

CUDAKernel
│    
└───include
|   |   AbstractGpuSimulation.hpp
|   |   CosmicConstants.cuh
|   |   CosmicUtils.cuh
|   |   CudaErrorCheck.cuh
|   |   OneDimensionBpGpuSimulation.hpp
|   |   OneDimensionBpSimulation.cuh
|   |   OneDimensionFpGpuSimulation.hpp
|   |   OneDimensionFpSimulation.cuh
|   |   ThreeDimensionBpGpuSimulation.hpp
|   |   ThreeDimensionBpSimulation.cuh
|   |   TwoDimensionBpGpuSimulation.hpp
|   |   TwoDimensionBpSimulation.cuh
└───src
    |   CosmicConstants.cu
    |   CosmicUtils.cu
    |   OneDimensionBpGpuSimulation.cpp
    |   OneDimensionBpSimulation.cu
    |   OneDimensionFpGpuSimulation.cpp
    |   OneDimensionFpSimulation.cu
    |   ThreeDimensionBpGpuSimulation.cpp
    |   ThreeDimensionBpSimulation.cu
    |   TwoDimensionBpGpuSimulation.cpp
    |   TwoDimensionBpSimulation.cu

CUDA Kernel module contains following source files:

  • AbstractGpuSimulation.hpp - Abstract definition for implementation of model on GPU.

  • CosmicConstants.cuh - Header file for constants needed for simulations.

  • CosmicUtils.cuh - Header file for common functions for simulations.

  • CudaErrorCheck.cuh - Header file for utilities for checking errors.

  • OneDimensionBpGpuSimulation.hpp - Header file for class utilizing GPU implementation of 1D B-p model.

  • OneDimensionBpSimulation.cuh - Header file for GPU implementation of 1D B-p model.

  • OneDimensionFpGpuSimulation.hpp - Header file for class utilizing GPU implementation of 1D F-p model.

  • OneDimensionFpSimulation.cuh - Header file for GPU implementation of 1D F-p model.

  • ThreeDimensionBpGpuSimulation.hpp - Header file for class utilizing GPU implementation of Geliosphere 2D B-p model.

  • ThreeDimensionBpGpuSimulation.cuh - Header file for GPU implementation of Geliosphere 2D B-p model.

  • TwoDimensionBpGpuSimulation.hpp - Header file for class utilizing GPU implementation of SolarProp-like 2D B-p model.

  • TwoDimensionBpSimulation.cuh - Header file for GPU implementation of SolarProp-like 2D B-p model.

  • CosmicConstants.cu - Source file for constants needed for simulations.

  • CosmicUtils.cu - Source file for common functions for simulations.

  • OneDimensionBpGpuSimulation.cpp - Source file for class utilizing GPU implementation of 1D B-p model.

  • OneDimensionBpSimulation.cu - Source file for GPU implementation of 1D B-p model.

  • OneDimensionFpGpuSimulation.cpp - Source file for class utilizing GPU implementation of 1D F-p model.

  • OneDimensionFpSimulation.cu - Source file for GPU implementation of 1D F-p model.

  • ThreeDimensionBpGpuSimulation.cpp - Source file for class utilizing GPU implementation of Geliosphere 2D B-p model.

  • ThreeDimensionBpGpuSimulation.cu - Source file for GPU implementation of Geliosphere 2D B-p model.

  • TwoDimensionBpGpuSimulation.cpp - Source file for class utilizing GPU implementation of SolarProp-like 2D B-p model.

  • TwoDimensionBpSimulation.cu - Source file for GPU implementation of SolarProp-like 2D B-p model.

Utils module

Utils
│    
└───include
|   |   FileUtils.hpp
|   |   ResultsUtils.hpp
└───src
    |   FileUtils.cpp
    |   ResultsUtils.cpp

Utils module contains following source files:

  • FileUtils.hpp - Header file for utilities for manipulating with directories.
  • ResultsUtils.hpp - Header file for utilities for analyting log files.
  • FileUtils.cpp - Source file for utilities for manipulating with directories.
  • ResultsUtils.cpp - Source file for utilities for analyting log files.