nlcpy.jit.CustomVELibrary

class nlcpy.jit.CustomVELibrary(*, code=None, path=None, cflags=None, ldflags=None, log_stream=None, compiler='/opt/nec/ve/bin/ncc', use_nlc=False, ftrace=False, dist_dir=None)[source]

Custom VE library class.

This class provides simple wrapper functionalities related to compiling by ncc/nc++/nfort and linking with shared objects for the VE.

It can be used to either compile and load from a C/C++/Fortran source or load from a pre-built shared object.

The instance of this class holds a handle of the loaded VE library. To retrieve a callable VE function from the instance, please call a method get_function().

Parameters
codestr

C/C++/Fortran source code. Mutually exclusive with path.

pathstr

Pre-built shared object path. Mutually exclusive with code.

cflagstuple of str

Compilation flags. The default is given by nlcpy.jit.get_default_cflags().

ldflagstuple of str

Linking flags. The default is given by nlcpy.jit.get_default_ldflags().

log_streamobject

Pass either sys.stdout or a writable file object to which the compiler output will be written. Defaults to None.

compilerstr

Command to be used for compiling and linking. Defaults to '/opt/nec/be/bin/ncc'. You can also specify 'nfort' or 'nc++'.

use_nlcbool

Whether the VE source links with NLC or not. If set to True, the OpenMP and 64bit integer library of NLC will be set to the cflags and ldflags internally. Defaults to False.

ftracebool

Whether the VE source links with ftrace or not. Defaults to False.

dist_dirstr

Directory path that stores the source code, the object file, and the shared object file. By default, the files are stored into a temporary directory and are removed after constructing this instance.

Note

Only the OpenMP & 64bit integer version of the NLC can be used.

Methods

get_function(func_name, args_type=(), ret_type='void')[source]

Retrieve a VE function by its name from a library.

Parameters
func_namestr

Name of the VE function.

args_typetuple of str

Data types for the arguments of the VE function. You can also specify this from constants.

ret_typestr

Data type for the return value of the VE function. You can also specify this from constants.

Returns
kernelnlcpy.jit.CustomVEKernel

The callable VE kernel.

__eq__(value, /)

Return self==value.

__ne__(value, /)

Return self!=value.

__lt__(value, /)

Return self<value.

__le__(value, /)

Return self<=value.

__gt__(value, /)

Return self>value.

__ge__(value, /)

Return self>=value.

Attributes

id