CUDAStandaloneDevice class
(Shortest import: from brian2cuda.device import CUDAStandaloneDevice)
- class brian2cuda.device.CUDAStandaloneDevice[source]
The
Device
used for CUDA standalone simulations.Methods
build
([directory, compile, run, debug, ...])Build the project
check_openmp_compatible
(nb_threads)code_object
(owner, name, abstract_code, ...)code_object_class
([codeobj_class, fallback_pref])Return
CodeObject
class (eitherCUDAStandaloneCodeObject
class or input)copy_source_files
(writer, directory)fill_with_array
(var, *args, **kwargs)Fill an array with the values given in another array.
generate_codeobj_source
(writer)generate_main_source
(writer)generate_makefile
(writer, cpp_compiler, ...)generate_network_source
(writer)generate_objects_source
(writer, ...)generate_rand_source
(writer)generate_run_source
(writer)generate_synapses_classes_source
(writer)get_array_name
(var[, access_data, prefix])Return a globally unique name for
var()
.get_array_read_write
(abstract_code, variables)network_restore
(net, *args, **kwds)network_run
(net, duration[, report, ...])network_store
(net, *args, **kwds)Details
- build(directory='output', compile=True, run=True, debug=False, clean=False, with_output=True, disable_asserts=False, additional_source_files=None, run_args=None, direct_call=True, **kwds)[source]
Build the project
TODO: more details
- Parameters:
directory : str, optional
The output directory to write the project to, any existing files will be overwritten. If the given directory name is
None
, then a temporary directory will be used (used in the test suite to avoid problems when running several tests in parallel). Defaults to'output'
.compile : bool, optional
Whether or not to attempt to compile the project. Defaults to
True
.run : bool, optional
Whether or not to attempt to run the built project if it successfully builds. Defaults to
True
.debug : bool, optional
Whether to compile in debug mode. Defaults to
False
.with_output : bool, optional
Whether or not to show the
stdout
of the built program when run. Output will be shown in case of compilation or runtime error. Defaults toTrue
.clean : bool, optional
Whether or not to clean the project before building. Defaults to
False
.additional_source_files : list of str, optional
A list of additional
.cu
files to include in the build.direct_call : bool, optional
Whether this function was called directly. Is used internally to distinguish an automatic build due to the
build_on_run
option from a manualdevice.build
call.
- code_object(owner, name, abstract_code, variables, template_name, variable_indices, codeobj_class=None, template_kwds=None, override_conditional_write=None, compiler_kwds=None)[source]
- code_object_class(codeobj_class=None, fallback_pref=None)[source]
Return
CodeObject
class (eitherCUDAStandaloneCodeObject
class or input)- Parameters:
codeobj_class : a
CodeObject
class, optionalIf this is keyword is set to None or no arguments are given, this method will return the default (
CUDAStandaloneCodeObject
class).fallback_pref : str, optional
For the cuda_standalone device this option is ignored.
- Returns:
codeobj_class : class
The
CodeObject
class that should be used
- fill_with_array(var, *args, **kwargs)[source]
Fill an array with the values given in another array.
- Parameters:
var :
ArrayVariable
The array to fill.
arr :
ndarray
The array values that should be copied to
var()
.
- generate_makefile(writer, cpp_compiler, cpp_compiler_flags, cpp_linker_flags, debug, disable_asserts)[source]
- get_array_name(var, access_data=True, prefix=None)[source]
Return a globally unique name for
var()
.- Parameters:
access_data : bool, optional
prefix: {‘_ptr’, ‘dev’, ‘d’}, optional :
Prefix for array name. Host pointers to device memory are prefixed with
dev
, device pointers to device memory are prefixed withd
and pointers used inscalar_code
andvector_code
are prefixed with_ptr
(independent of whether they are used in host or device code). The_ptr
variables are declared as parameters in the kernel definition (KERNEL_PARAMETERS).