Skip to content
Snippets Groups Projects
Commit fb15aadf authored by Untung Tanujaya's avatar Untung Tanujaya
Browse files

add ARRSIZE

parent a771c9ce
Branches
No related merge requests found
......@@ -8,6 +8,8 @@
using namespace std;
#define ARRSIZE 10000
//fungsi cari isi array yg terbesar
__global__ void getMax(unsigned int* array, int n) {
const int tid = blockDim.x * blockIdx.x + threadIdx.x;
......@@ -41,7 +43,7 @@ __global__ void countOccurences(unsigned int * arr, int n, int * count, unsigned
int main(int argc, char *argv[]) {
curandGenerator_t curandGenerator;
cudaEvent_t start, end;
const long count = 200000;
const long count = ARRSIZE;
unsigned int dst[count];
unsigned int * src;
int g, b;
......@@ -54,6 +56,9 @@ int main(int argc, char *argv[]) {
curandSetPseudoRandomGeneratorSeed(curandGenerator, 13516042);
cudaMalloc(&src, count * sizeof(unsigned int));
curandGenerate(curandGenerator, src, count);
cudaDeviceSynchronize();
cudaMemcpy(dst, src, count * sizeof(int), cudaMemcpyDeviceToHost);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment