-
Notifications
You must be signed in to change notification settings - Fork 12
Error handling
Raul edited this page Apr 29, 2021
·
1 revision
Almost everywhere a piece of uammd code can fail a C++ exception[1] will be thrown that the user can catch and handle.
If the error that resulted in the exception being thrown has not left the program in an unrecoverable state (which is often the case with CUDA errors) the user can handle the exception and continue the execution.
See the following example
#include<uammd.cuh>
#include<utils/exception.h>
#include<cstdlib>
#include<iostream>
using namespace uammd;
auto createSystem(int argc, char **argv){
try{
return std::make_shared<System>(argc, argv);
}
catch(uammd::exception &e){
System::log<System::WARNING>("Recovering from System exception");
System::log<System::ERROR>("Backtrace:");
uammd::backtrace_nested_exception(e);
return createSystem(0, nullptr);
}
}
//Try to call this program with an invalid input, for example ./a.out --device -100
//System creation will fail and try to recover
int main(int argc, char **argv){
auto sys = createSystem(argc, argv);
int N =100;
auto pd = std::make_shared<ParticleData>(N, sys);
auto pos = pd->getPos(access::location::cpu, access::mode::write);
try{
auto pos_illegal = pd->getPos(access::location::cpu, access::mode::read);
}
catch(uammd::illegal_property_access &e){
sys->log<System::WARNING>("Recovering from access exception");
uammd::backtrace_nested_exception(e);
}
sys->finish();
return EXIT_SUCCESS;
};
-
-
1. PairForces
2. NbodyForces
3. ExternalForces
4. BondedForces
5. AngularBondedForces
6. TorsionalBondedForces
7. Poisson (Electrostatics) -
-
MD (Molecular Dynamics)
1. VerletNVT
2. VerletNVE - BD Brownian Dynamics
-
BDHI Brownian Dynamics with Hydrodynamic Interactions
1. EulerMaruyama
1.1 BDHI_Cholesky Brownian displacements through Cholesky factorization.
1.2 BDHI_Lanczos Brownian displacements through Lanczos algorithm.
1.3 BDHI_PSE Positively Split Edwald.
1.4 BDHI_FCM Force Coupling Method. - DPD Dissipative Particle Dynamics
- SPH Smoothed Particle Hydrodynamics
-
Hydrodynamics
1. ICM Inertial Coupling Method.
2. FIB Fluctuating Immerse Boundary.
3. Quasi2D Quasi2D hydrodynamics
-
MD (Molecular Dynamics)
-
- 1. Neighbour Lists
-
1. Programming Tools
2. Utils
-
1. Transverser
2. Functor
3. Potential
-
1. Particle Data
2. Particle Group
3. System
4. Parameter updatable
-
1. Tabulated Function
2. Postprocessing tools
3. InputFile
4. Tests
5. Allocator
6. Temporary memory
7. Immersed Boundary (IBM)
-
1. NBody
2. Neighbour Lists
3. Python wrappers
- 1. Superpunto