CUDAStandaloneDevice class

(Shortest import: from brian2cuda.device import CUDAStandaloneDevice)

class brian2cuda.device.CUDAStandaloneDevice[source]

The Device used for CUDA standalone simulations.


build([directory, compile, run, debug, ...])

Build the project


code_object(owner, name, abstract_code, ...)

code_object_class([codeobj_class, fallback_pref])

Return CodeObject class (either CUDAStandaloneCodeObject 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_makefile(writer, cpp_compiler, ...)


generate_objects_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)



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


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 to True.

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 manual 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 (either CUDAStandaloneCodeObject class or input)


codeobj_class : a CodeObject class, optional

If 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.


codeobj_class : class

The CodeObject class that should be used

copy_source_files(writer, directory)[source]
fill_with_array(var, *args, **kwargs)[source]

Fill an array with the values given in another array.


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]
generate_objects_source(writer, arange_arrays, synapses, static_array_specs, networks)[source]
get_array_name(var, access_data=True, prefix=None)[source]

Return a globally unique name for var().


access_data : bool, optional

For DynamicArrayVariable objects, specifying True here means the name for the underlying data is returned. If specifying False, the name of object itself is returned (e.g. to allow resizing).

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 with d and pointers used in scalar_code and vector_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).

get_array_read_write(abstract_code, variables)[source]
network_restore(net, *args, **kwds)[source]
network_run(net, duration, report=None, report_period=10. * second, namespace=None, profile=False, level=0, **kwds)[source]
network_store(net, *args, **kwds)[source]
variableview_set_with_index_array(variableview, *args, **kwargs)[source]