charm_misc#

Module defining some miscellaneous functions, macros, constants, etc.

Note

This documentation is written for double precision version of CHarm.

Defines

CHARM_VERSION_MAJOR 0#

Major version number of CHarm.

CHARM_VERSION_MINOR 4#

Minor version number of CHarm.

CHARM_VERSION_PATCH 6#

Patch number of CHarm.

CHARM_VERSION_STRING "0.4.6"#

Version of CHarm.

CHARM_MIN(a, b) (((a) < (b)) ? (a) : (b))#

Returns the minimum of a and b.

CHARM_MAX(a, b) (((a) > (b)) ? (a) : (b))#

Returns the maximum of a and b.

Functions

const char *charm_misc_get_version(void)#

Returns a string specifying the CHarm version number determined on compilation time.

void charm_misc_print_info(void)#

Prints library info to stdout (library name, version, compilation date, precision, etc).

int charm_misc_buildopt_precision(void)#

Returns:

  • 1 if CHarm was compiled in single precision (--enable-single-precision),

  • 2 if CHarm was compiled in double precision (--enable-double-precision or no precision flag),

  • 3 if CHarm was compiled quadruple precision (--enable-quad-precision).

int charm_misc_buildopt_simd(void)#

Returns:

  • 0 if CHarm was compiled with SIMD instructions disabled,

  • 1 if CHarm was compiled with AVX instructions enabled (--enable-avx),

  • 2 if CHarm was compiled with AVX2 instructions enabled (--enable-avx2),

  • 3 if CHarm was compiled with AVX-512 instructions enabled (--enable-avx-512),

  • 4 if CHarm was compiled with NEON instructions enabled (--enable-neon),

  • 5 if CHarm was compiled with SSE4.1 instructions enabled (--enable-sse4.1).

int charm_misc_buildopt_simd_vector_size(void)#

Returns the size of SIMD vectors if CHarm was compiled with SIMD instructions enabled and 1 otherwise (SIMD instructions disabled).

int charm_misc_buildopt_omp_charm(void)#

Returns a non-zero value if CHarm was compiled with the OpenMP parallelization enabled (--enable-openmp). Otherwise, zero is returned.

int charm_misc_buildopt_omp_fftw(void)#

Returns a non-zero value if the host’s FFTW library supports OpenMP parallelization. Otherwise, zero is returned.

If non-zero, FFTW computations are parallelized.

int charm_misc_buildopt_mpi(void)#

Returns a non-zero value if CHarm was compiled with the MPI parallelization enabled (--enable-mpi). Otherwise, zero is returned.

int charm_misc_buildopt_mpfr(void)#

Returns a non-zero value if CHarm was compiled with the MPFR enabled (--enable-mpfr). Otherwise, zero is returned.

const char *charm_misc_buildopt_version_fftw(void)#

Returns a string specifying the FFTW library version.

void charm_misc_buildopt_version_mpi(int *major_header, int *minor_header, int *major_lib, int *minor_lib)#

If CHarm was compiled with the MPI parallelization enabled (--enable-mpi), sets major_header, major_lib and minor_header, minor_lib to the version (major_*) and subversion (minor_*) of the MPI standard that is being supported by the linked MPI implementation. The *_header values are taken from the included MPI’s header file on compile time and the *_lib values are determined on runtime. If MPI parallelization is disabled, all four values are set to -1.

Note

All four version numbers are related to the MPI standard. To see the version of the linked MPI implementation, call charm_misc_print_info().

const char *charm_misc_buildopt_version_mpfr(int *major, int *minor, int *patch)#

If CHarm was compiled with the MPFR support (--enable-mpfr), returns a string determined on runtime specifying the MPFR library version and sets major, minor and patch to the symbolic constants MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR and MPFR_VERSION_PATCHLEVEL determined on compile time. Should any of the symbolic constants not be defined, the corresponding input parameter is set to -1.

If CHarm was compiled without the MPFR support, returns the n/a string and sets major, minor and patch to -1.

const char *charm_misc_buildopt_version_gmp(int *major, int *minor, int *patch)#

The same as charm_misc_buildopt_version_mpfr() but for the GMP library (note that --enable-gmp is not a valid installation flag, though).

int charm_misc_buildopt_isfinite(void)#

Returns a non-zero value if correctly working isfinite macro was found in the system’s math.h header file before the compilation. Otherwise, zero is returned.

On some systems, isfinite is available in math.h, but it is not working correctly with __float128 floating point data type (quadruple precision). The macro may also not work correctly with the -ffast-math compiler flag (e.g., gcc and clang). In these cases, zero is returned.