Skip to content
README.md 1.97 KiB
Newer Older
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed

VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
# Bindings

VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
## CXX bindings

How to configure and install:

1. `cmake .. -DCMAKE_INSTALL_PREFIX=<your_path> -DBUILD_C_FORTRAN=OFF`
2. `make install`

### How to use

```cpp
#include "nesmik/nesmik.hpp"
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed

int main() {
  nesmik::Init("Default");
  nesmik::RegionStart("peter");
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed

    nesmik::RegionStart("marie");
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed

    nesmik::RegionStop("marie");
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed

  nesmik::RegionStop("peter");
  nesmik::Finalize();
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
}
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
```
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed

You **must** call `nesmik::Init` exactly once to Init the datastructures before you can use the other functionality.
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
Also some backends require finalization, so please make sure to also call `finalize` in the end.

To add it to your code, currently just install it and use something similar to: 
`-I<nesmikprefix>/include -L-I<nesmikprefix>/lib -lnesmik` in the compiler options
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed

VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
## Fortran

How to configure and install:

1. `cmake .. -DCMAKE_INSTALL_PREFIX=<your_path> -DBUILD_C_FORTRAN=ON`
2. `make install`

### How to use

```fortran
program test
    use nesmik_mod
    call Init("Default")
    call RegionStart("test")
    call RegionStop("test")
    call Finalize()
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
  end program test
```



You **must** call `Init` exactly once to Init the datastructures before you can use the other functionality.
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
Also some backends require finalization, so please make sure to also call `finalize` in the end.

To add it to your code, currently just install it and use something similar to:
`gfortran -I./<install-prefix>/include <yourfile>.f90 -o <yourfile> <install-prefix>/lib/libnesmik_f.a <install-prefix>/lib/libnesmik.so` in the compiler of your choice.
VALENTIN SEITZ's avatar
VALENTIN SEITZ committed


VALENTIN SEITZ's avatar
VALENTIN SEITZ committed
# Backends

## DLB

### Building 

To build the DLB backend please make sure you have `DLB_HOME` set in your enviroment or provide the installation dir of dlb with `-DDLB_DIR`
To configure: `cmake .. -DENABLE_DLB=ON -DCMAKE_INSTALL_PREFIX=<youreprefix> -DBUILD_C_FORTRAN=OFF`

Please note, that you may have to add the DLB location to the library path, but as you probably preload it anyway, this shoule be fine :)

### Usage

`nesmik::Init("DLB")`