Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions brian2cuda/templates/synapses.cu
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ printf("INFO _run_kernel_{{codeobj_name}}: Using %d threads per bundle\n", num_t
num_loops = 1;

{% elif synaptic_effects == "target" %}{# not uses_atomics #}
LOG_ERROR("Internal error, check this line with git blame in brian2cuda source code: %s(%d)\n", __FILE__, __LINE__);
exit(1);
// Synaptic effects modify target group variables but NO source group variables.
num_blocks = num_parallel_blocks;
num_loops = 1;
Expand Down
10 changes: 9 additions & 1 deletion brian2cuda/templates/synapses_create_array.cu
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ CUDA_CHECK_MEMORY();
// update the total number of synapses
{{N}} = newsize;

{# We don't care about ocurrences of multiple source-target pairs if we have
not multisynaptic indices in the model and are using atomics in
synapses.cu. Unfortunately, we don't know here if we are using atomics
in synapses.cu. Need to find a way to expose that boolean here via
CudaGenerator, where it is set. But for now, we assume, synapses.cu uses
atomics (else there an error is raised there) #}
{% if multisynaptic_index %}
// Check for occurrence of multiple source-target pairs in synapses ("synapse number")
std::map<std::pair<int32_t, int32_t>, int32_t> source_target_count;
for (int _i=0; _i<newsize; _i++)
Expand All @@ -121,7 +128,8 @@ for (int _i=0; _i<newsize; _i++)
{% endif %}
}
}
// Check
{% endif %}

// copy changed host data to device
dev{{_dynamic_N_incoming}} = {{_dynamic_N_incoming}};
dev{{_dynamic_N_outgoing}} = {{_dynamic_N_outgoing}};
Expand Down
8 changes: 8 additions & 0 deletions brian2cuda/templates/synapses_create_generator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,13 @@ std::cout << std::endl;
// Also update the total number of synapses
{{N}} = newsize;

{# We don't care about ocurrences of multiple source-target pairs if we have
not multisynaptic indices in the model and are using atomics in
synapses.cu. Unfortunately, we don't know here if we are using atomics
in synapses.cu. Need to find a way to expose that boolean here via
CudaGenerator, where it is set. But for now, we assume, synapses.cu uses
atomics (else there an error is raised there) #}
{% if multisynaptic_index %}
// Check for occurrence of multiple source-target pairs in synapses ("synapse number")
std::map<std::pair<int32_t, int32_t>, int32_t> source_target_count;
for (int _i=0; _i<newsize; _i++)
Expand All @@ -447,6 +454,7 @@ std::cout << std::endl;
{% endif %}
}
}
{% endif %}

// copy changed host data to device
dev{{_dynamic_N_incoming}} = {{_dynamic_N_incoming}};
Expand Down