Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Parallel execution #259

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Change variable in template
  • Loading branch information
SudeshnaBora committed Apr 6, 2022
commit 54cac5ff16f26881cee3713644a247250fd61ada
5 changes: 3 additions & 2 deletions brian2cuda/templates/network.cu
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ void Network::run(const double duration, void (*report_func)(const double, const
// get maximum in objects.cu array

// go through each list of func group - 2 loops
for(int i=0; i<func_groups[j].size(); i++) {
for(int i=0; i<func_groups.size(); i++) {
codeobj_func func = func_groups[i].second;
func(cuda_streams[i]);
//func(cuda_streams[i]);
func();
}

for(std::set<Clock*>::iterator i=curclocks.begin(); i!=curclocks.end(); i++)
Expand Down
6 changes: 3 additions & 3 deletions brian2cuda/templates/objects.cu
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const int brian::_num_{{varname}} = {{var.size}};

///////////////// array of streams for parallelization //////////////////////////
{% if parallelize %}
cudaStream_t brian::custom_stream[{{num_stream}}];
cudaStream_t brian::custom_stream[{{stream_size}}];
{% endif %}

//////////////// eventspaces ///////////////
Expand Down Expand Up @@ -233,7 +233,7 @@ void _init_arrays()
{% endif %}

{% if parallelize %}
for(int i=0;i<num_stream;i++){
for(int i=0;i<{{stream_size}};i++){
CUDA_SAFE_CALL(cudaStreamCreate(&(custom_stream[i])));
}
{% endif %}
Expand Down Expand Up @@ -613,7 +613,7 @@ extern thrust::device_vector<{{c_data_type(var.dtype)}}>* {{varname}};

//////////////// stream ////////////
{% if parallelize %}
extern cudaStream_t custom_stream[{{num_stream}}];
extern cudaStream_t custom_stream[{{stream_size}}];
{% endif %}


Expand Down