3.1. Common runtime options

3.1.1. Determining the number of CPUs

Nanos6 applications can be executed as is. The number of cores that are used is controlled by running the application through the taskset command. For instance:

$ taskset -c 0-2,4 ./app

would run app on cores 0, 1, 2 and 4.

In addition, the runtime comes with several variants that can be selected through the NANOS6 environment variable.

3.1.2. Stack Size

Nanos6 by default allocates stacks of 8 MB for its worker threads. In some codes this may not be enough. For instance, when converting Fortran codes, some global variables may need to be converted into local variables. This may increase substantially he amount of stack required to run the code and may surpass the space that is available. To solve that problem, the stack size can be set through the NANOS6_STACK_SIZE environment variable. Its value is expressed in bytes but it also accepts the K, M, G, T and E suffixes, that are interpreted as power of 2 multipliers.


$ export NANOS6_STACK_SIZE=16M

3.1.3. Values for the NANOS6 Environment Variable

The NANOS6 environment variable selects the variant of the runtime that will be used. Currently it supports the following variants:

This is the default value and selects the standard runtime based on pthreads.
Runtime compiled without optimization and with all assertions turned on.
Instrumented to produce paraver traces. See: Generating extrae traces
Instrumented to emit a log of the execution. See: Verbose instrumentation
Instrumented to emit a log of the execution and compiled without optimization and with all assertions turned on. See: Verbose instrumentation
Instrumented to produce a graph of the execution. Only practical for small graphs. See: Generating a graphical representation of the dependency graph
Instrumented to produce a function and source code execution profile. See: Sampling-based profiling
Instrumented to produce a summary of metrics of the execution. See: Obtaining statistics
Instrumented to produce a summary of metrics of the execution including hardware counters. See: Obtaining statistics

3.1.4. Loading runtime verbosity

The NANOS6_LOADER_VERBOSE environment controls the verbosity of the Nanos6 Loader. By default (0 value), it is quiet. If the environment variable has value 1 it will emit to standard error the actions that it takes and their outcome.

By default the loader will attempt to load the actual runtime library from the path determined by the operating system (taking into account the rpath and the LD_LIBRARY_PATH environment variable). If it fails to load the library, then it will attempt to locate the library at the same location as the nanos6 loader.

The default search path can be overriden through the NANOS6_LIBRARY_PATH environment variable. If it exists the first attempt at loading the runtime will be performed at the directory specified in that variable. The loader does not accept multiple directories in that variable.

The nanos6 loader resolves the addresses of the API functions to the actual runtime implementation. In addition it also checks for the implementation of some features, and if they are not found, it will either complain of emit a warning an fall back to a compatible but less powerful implementation. More specifically, the loader accepts running applications that make use of weak dependencies and will fall back to strong dependencies if the runtime does not have support for them.

3.1.5. Common environment variables

The following environment variables are valid for the runtime implementations.

  • NANOS6_HANDLE_SIGINT: (default value: 0), Intercept the SIGINT signal to perform an unclean shutdown that does actually finalize the instrumentation (if any).
  • NANOS6_HANDLE_SIGTERM: (default value: 0), Intercept the SIGTERM signal to perform an unclean shutdown that does actually finalize the instrumentation (if any).
  • NANOS6_HANDLE_SIGQUIT: (default value: 0), Intercept the SIGQUIT signal to perform an unclean shutdown that does actually finalize the instrumentation (if any).

The NANOS6_HANDLE_SIGINT, NANOS6_HANDLE_SIGTERM and NANOS6_HANDLE_SIGQUIT environment variables are useful to get the output of the instrumentation at a given point in the execution. For instance, if the application misbehaves, running it with NANOS6_HANDLE_SIGINT=1 with an instrumented version of the runtime and pressing Ctrl-C at the precise moment will terminate the application with the instrumentation information generated up to that point.

Alternatively, if the misbehavior is deterministic, the code may perform a call to raise(SIGINT) to produce the same effect programmatically.