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
Add CUDA stream parameter to codeobj_func typedef
This also adds an unused `stream` parameter to the RNG function, which
is the only network function that always runs in the default stream (for
now).
  • Loading branch information
denisalevi committed Apr 8, 2022
commit 1a1c7e9d98b141e075e53b73b8aae1a6d062fffd
2 changes: 1 addition & 1 deletion brian2cuda/templates/network.cu
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Clock* Network::next_clocks()
#include <ctime>
#include "brianlib/clocks.h"

typedef void (*codeobj_func)();
typedef void (*codeobj_func)(cudaStream_t);

class Network
{
Expand Down
7 changes: 4 additions & 3 deletions brian2cuda/templates/rand.cu
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ namespace {


// need a function pointer for Network::add(), can't pass a pointer to a class
// method, which is of different type
void _run_random_number_buffer()
// method, which is of different type. Random number buffer runs in default
// stream always, the `stream` parameter is not used.
void _run_random_number_buffer(cudaStream_t stream)
{
// random_number_buffer is a RandomNumberBuffer instance, declared in objects.cu
random_number_buffer.next_time_step();
Expand Down Expand Up @@ -472,7 +473,7 @@ void RandomNumberBuffer::next_time_step()

#include <curand.h>

void _run_random_number_buffer();
void _run_random_number_buffer(cudaStream_t);

class RandomNumberBuffer
{
Expand Down