Service

The service functions are defined in the following files:

  • C / C++ header: include/nvpl_lapack_service.h

Version Information

nvpl_lapack_get_version()

  • C / C++

    int nvpl_lapack_get_version()

Returns the library version in the following format: NVPL_LAPACK_VERSION_MAJOR * 10000 + NVPL_LAPACK_VERSION_MINOR * 100 + NVPL_LAPACK_VERSION_PATCH.

Threading Control

nvpl_lapack_get_max_threads()

  • C / C++

    int nvpl_lapack_get_max_threads()

Returns the number of threads available for NVPL LAPACK to use for parallelization. If a thread local number of threads was set, this function will return the thread local number. Otherwise, the global number of threads is returned.

nvpl_lapack_set_num_threads()

  • C / C++

    void nvpl_lapack_set_num_threads(int nthr)

Sets the number of threads that NVPL LAPACK should use.

  • Default: 0.

  • Use 0 to follow the threading runtime defaults. Negative nthr is ignored.

  • The function has no effect for sequential library.

nvpl_lapack_set_num_threads_local()

  • C / C++

    int nvpl_lapack_set_num_threads_local(int nthr_local)

Sets the (thread) local number of threads that the library should use when called from the current thread. This function is useful when the library is called from different threads which might require different nested threading behavior.

  • Default: 0.

  • Use 0 to follow the global settings. Negative nthr_local is ignored.

  • This function takes precedence over nvpl_lapack_set_num_threads().

  • The function has no effect for sequential library.

It is advised to set the thread-local number of threads to the previous value or reset it.

Returns the previous value of nthr_local.

Math Mode

The math mode defines which mode NVPL LAPACK will use for the computations inside the library. For possible values, see Service Types.

nvpl_lapack_get_math_mode()

  • C / C++

    nvpl_lapack_math_mode_t nvpl_lapack_get_math_mode()

Returns current math mode. If a thread local math mode was set, this function will return the thread local math mode. Otherwise, the global math mode is returned.

nvpl_lapack_set_math_mode()

  • C / C++

    void nvpl_lapack_set_math_mode(nvpl_lapack_math_mode_t math_mode)

Sets the global math mode of NVPL LAPACK. Default: NVPL_LAPACK_MATH_MODE_DEFAULT.

nvpl_lapack_set_math_mode_local()

  • C / C++

    nvpl_lapack_math_mode_t nvpl_lapack_set_math_mode_local(nvpl_lapack_math_mode_t math_mode)

Sets the thread local math mode of NVPL LAPACK. Default: use global math mode. This function takes precedence over nvpl_lapack_set_math_mode(). Setting NVPL_LAPACK_MATH_MODE_USE_GLOBAL will disable thread local math mode settings.

It is advised to set the thread-local math mode after use to the previous value or reset it.

Returns the previous value of local math mode.

Environment Mode

The environment mode is used to ignore or respect the value of NVPL LAPACK specific environment variables. See also Library Specific and Service Types.

nvpl_lapack_get_env_mode()

  • C / C++

    nvpl_lapack_env_mode_t nvpl_lapack_get_env_mode()

Returns current environment mode. If a thread local environment mode was set, this function will return the thread local environment mode. Otherwise, the global environment mode is returned.

nvpl_lapack_set_env_mode()

  • C / C++

    void nvpl_lapack_set_env_mode(nvpl_lapack_env_mode_t env_mode)

Sets the global environment mode of NVPL LAPACK. Default: NVPL_LAPACK_ENV_MODE_DEFAULT.

nvpl_lapack_set_env_mode_local()

  • C / C++

    nvpl_lapack_env_mode_t nvpl_lapack_set_env_mode_local(nvpl_lapack_env_mode_t env_mode)

Sets the thread local environment mode of NVPL LAPACK. Default: NVPL_LAPACK_ENV_MODE_DEFAULT. This function takes precedence over nvpl_lapack_set_env_mode(). Setting NVPL_LAPACK_ENV_MODE_USE_GLOBAL will disable thread local environment mode settings.

It is advised to set the thread-local env mode after use to the previous value or reset it.

Returns the previous value of local env mode.