![]() |
IgANet
IgANets - Isogeometric Analysis Networks
|
In this tutorial you will get to know the structure of IgANets and how to write your first program.
The source code can be obtained from https://github.com/IgANets/IgaNet as well as https://gitlab.com/iganets/iganet.
It contains the following sub-folders:
docs
contains the documentationexamples
contains several examplesfiledata
contains some example data filesinclude
contains the IgANet header filesmex
contains some Matlab MEX functionsops
contains files for creating Docker imagesperftest
contains some performance testspython
contains the Python wrapperunittests
contains the unit testswebapps
contains the WebApp codeIn order to utilize IgANets in your application you need to
iganet.h
,iganet::init()
to initialize some internals at the start of the program, andiganet::finalize()
to clean up internals at the end of the programThe following toy application
will output some information about the system it is run on, e.g.,
The above information may vary depending on the compiler, the LibTorch version, the CMake settings, and the system configuration.
If your application is compiled with IGANET_WITH_OPENMP=YES
you can set the number of OpenMP threads by running your application with
Note that by default all OpenMP threads are used for intra-op parallelization and the number of threads for inter-op parallelization is set to one. The difference between intra- and inter-op parallelization is explained in the PyTorch documentation. You can change this behavior by running your application with
which will change the information to
IgANets checks all available devices during initialization. Unless the environment variables IGANET_DEVICE
and/or IGANET_DEVICE_INDEX
are set, it uses the first GPU as default device and falls back to CPU mode otherwise.
The following device types are supported depending on your system
IGANET_DEVICE | description |
---|---|
CUDA | NVIDIA GPUs, requires CUDA-enabled LibTorch library |
HIP | AMD GPUs, requires ROCM-enabled LibTorch library |
MPS | Apple Silicon Metal Performance Shaders |
XLA | XLA devices such as Google's TPUs, requires XLA-enabled LibTorch library, see documentation |
XPU | Intel GPUs, see documentation |
If you want to know the default configuration of your system you can create an Options
object and print it
which might give you the following output
All parameters of the Options
object can be retrieved individually, e.g.
yields the output
The object's parameters cannot be changed in place. Instead, a new Options
object with changed parameters needs to be created, e.g.
yields the output
IgANets has its own logging mechanism. Instead of writing output to std::cout
and std:cerr
it is recommended to write ouput to iganet::Log(...)
and specify the log level as follows
log level | description |
---|---|
iganet::log::none | no logging |
iganet::log::fatal | fatal error |
iganet::log::error | error |
iganet::log::warning | warning |
iganet::log::info | information |
iganet::log::debug | debug information |
iganet::log::verbose | verbose information |
For example, the following code snippet
will print
By default, iganet::Log()
prints the output as iganet::log::info
.
The log level can be set by calling iganet::Log.setLogLevel(...)
with the requested log level. Once set, only log levels of the set type and below, i.e. more severe will be printed, e.g.,
will only print
Finally, it is possible to write the output into a logfile by calling
This will create a file output.log
with the content