This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cuda.h> | |
| #include <chrono> | |
| #include <cstdlib> | |
| #include <iostream> | |
| __global__ void addVectorsKernel(const double* A, const double* B, double* C, double n) { | |
| int i = blockDim.x * blockIdx.x + threadIdx.x; | |
| if (i < n) { | |
| C[i] = A[i] + B[i]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cuda.h> | |
| #include <chrono> | |
| #include <cstdlib> | |
| #include <iostream> | |
| __global__ void transposeKernel(const double* A, double* AT, int N) { | |
| int xIndex = blockDim.x * blockIdx.x + threadIdx.x; | |
| int yIndex = blockDim.y * blockIdx.y + threadIdx.y; | |
| int index = xIndex + N * yIndex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cuda.h> | |
| #include <cuda_runtime.h> | |
| #include <device_launch_parameters.h> | |
| #include <cstdlib> | |
| #include <iostream> | |
| __global__ void DivergencyKernel(float* a, int N) { | |
| int x = blockDim.x * blockIdx.x + threadIdx.x; | |
| if (x % 2 == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cuda.h> | |
| #include <cuda_runtime.h> | |
| #include <device_launch_parameters.h> | |
| #include <chrono> | |
| #include <cstdlib> | |
| #include <iostream> | |
| __global__ void reverseKernel(float* A, int N) { | |
| int i = blockDim.x * blockIdx.x + threadIdx.x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // UCSC CMPE220 Advanced Parallel Processing | |
| // Prof. Heiner Leitz | |
| // Author: Marcelo Siero. | |
| // Modified from code by:: Andreas Goetz (agoetz@sdsc.edu) | |
| // CUDA program to perform 1D stencil operation in parallel on the GPU | |
| // | |
| // /* FIXME */ COMMENTS ThAT REQUIRE ATTENTION | |
| #include <cuda.h> | |
| #include <device_launch_parameters.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // | |
| // | |
| // Created by Elijah Afanasiev on 25.09.2018. | |
| // | |
| // | |
| // System includes | |
| #include <assert.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cuda.h> | |
| #include <cuda_runtime.h> | |
| #include <device_launch_parameters.h> | |
| #include <stdio.h> | |
| #include <cstdlib> | |
| #include <iostream> | |
| __global__ void vectorAddGPU(float* a, float* b, float* c, int N) { | |
| int idx = blockIdx.x * blockDim.x + threadIdx.x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cuda_profiler_api.h> | |
| #include <cfloat> | |
| #include <chrono> | |
| #include <iostream> | |
| using namespace std; | |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| cudaError_t SAFE_CALL(cudaError_t result) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // | |
| // | |
| // Created by Elijah Afanasiev on 25.09.2018. | |
| // | |
| // | |
| // System includes | |
| #include <assert.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // High level matrix multiplication on GPU using CUDA with Thrust, CURAND and | |
| // CUBLAS C(m,n) = A(m,k) * B(k,n) | |
| #include <cublas_v2.h> | |
| #include <curand.h> | |
| #include <cstdlib> | |
| #include <ctime> | |
| #include <iostream> | |
| #include <thrust/device_vector.h> | |
| #include <thrust/host_vector.h> |
OlderNewer