From 861aacbcf804530ce6118f5a7f9c475cfbbd23fe Mon Sep 17 00:00:00 2001 From: amal-majunu <56107293+amal-majunu@users.noreply.github.com> Date: Mon, 27 Apr 2020 19:00:44 +0530 Subject: [PATCH 1/3] deleted the wrong file --- Assignment2 | 57 ----------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 Assignment2 diff --git a/Assignment2 b/Assignment2 deleted file mode 100644 index aa25e10..0000000 --- a/Assignment2 +++ /dev/null @@ -1,57 +0,0 @@ -#include -using namespace std; - -__global__ void Add(float *d_a,float *d_b,float *d_c,int r,int c){ - - int i =blockIdx.x*blockDim.x+threadIdx.x; - int j =blockIdx.y*blockDim.y+threadIdx.y; - int k = i+j*c; - //i is defined for horizontal traversal - if(i>r>>c; - float h_a[r][c],h_b[r][c],h_c[r][c]; - for(i=0;i>>(d_a,d_b,d_c,r,c); - cudaMemcpy(h_c, d_c, (r*c)*sizeof(float), cudaMemcpyDeviceToHost); - - cout<<"Sum of the 2 matrices is:\n"; - for(i=0;i Date: Mon, 27 Apr 2020 19:14:07 +0530 Subject: [PATCH 2/3] Assignment2 --- 96752745_Amal/assignment2.cu | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 96752745_Amal/assignment2.cu diff --git a/96752745_Amal/assignment2.cu b/96752745_Amal/assignment2.cu new file mode 100644 index 0000000..9ace3b7 --- /dev/null +++ b/96752745_Amal/assignment2.cu @@ -0,0 +1,57 @@ +#include +using namespace std; + +__global__ void Add(float *d_a,float *d_b,float *d_c,int r,int c){ + + int i =blockIdx.x*blockDim.x+threadIdx.x; + int j =blockIdx.y*blockDim.y+threadIdx.y; + int k = i+j*c; + //i is defined for horizontal traversal + if(i>r>>c; + float h_a[r][c],h_b[r][c],h_c[r][c]; + for(i=0;i>>(d_a,d_b,d_c,r,c); + cudaMemcpy(h_c, d_c, (r*c)*sizeof(float), cudaMemcpyDeviceToHost); + + cout<<"Sum of the 2 matrices is:\n"; + for(i=0;i Date: Wed, 29 Apr 2020 22:39:38 +0530 Subject: [PATCH 3/3] Assignment3 --- 96752745_Amal/assignment3.cu | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 96752745_Amal/assignment3.cu diff --git a/96752745_Amal/assignment3.cu b/96752745_Amal/assignment3.cu new file mode 100644 index 0000000..8a0795a --- /dev/null +++ b/96752745_Amal/assignment3.cu @@ -0,0 +1,53 @@ +#include +using namespace std; + +__global__ void Transpose(int *d_a,int max){ + +int i = blockIdx.x*blockDim.x+threadIdx.x; +int j = blockIdx.y*blockDim.y+threadIdx.y; +int id1 = i+max*j; +int id2 = j+max*i; +__syncthreads(); + +if(i>r>>c; + max=r>c?r:c; + int h_a[max][max]={0}; + for(i=0;i>>(d_a,max); + cudaMemcpy(h_a, d_a, max*max*sizeof(int), cudaMemcpyDeviceToHost); + cout<<"The transpose matrix is:\n"; + for(i=0;i