Skip to content
Snippets Groups Projects
Commit b60be6aa authored by Elvina's avatar Elvina
Browse files

parallel 1 block 1 thread

parent 4f8e4540
Branches
No related merge requests found
......@@ -93,9 +93,6 @@ int main (int argc, char **argv) {
/* Read number of vertices */
printf("Number of vertices (n): "); scanf("%d", &n);
cudaMallocManaged(&matrix, n*sizeof(long));
cudaMallocManaged(&result, n*sizeof(long));
matrix = initialize_matrix(13517142, n);
printf("\nGenerated %d * %d matrix.\n", n, n);
......@@ -150,7 +147,8 @@ void write_output(long matrix[], int n_row, int n_col, double time) {
long *initialize_matrix(int random_number, int n) {
/* Initialize variables */
long *matrix = (long *)malloc(sizeof(long) * n*n);
long *matrix;
cudaMallocManaged(&matrix, n*n*sizeof(long));
srand(random_number);
for (int i = 0; i < n; i++) {
......@@ -168,7 +166,8 @@ long *initialize_matrix(int random_number, int n) {
}
long *initialize_result(int n) {
long *result = (long *)malloc(sizeof(long) * n*n);
long *result;
cudaMallocManaged(&result, n*n*sizeof(long));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
......
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