Skip to content

Instantly share code, notes, and snippets.

View salamza's full-sized avatar
🏠
Working from home

Sameh Salama salamza

🏠
Working from home
View GitHub Profile
@salamza
salamza / cuda-vec_add.cu
Last active February 8, 2017 07:22
vector addition using CUDA API
/* File: vec_add.cu
* Purpose: Implement vector addition on a gpu using cuda
*
* Compile: nvcc [-g] [-G] -o vec_add vec_add.cu
* Run: ./vec_add
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
// This is the REAL "hello world" for CUDA!
// It takes the string "Hello ", prints it, then passes it to CUDA with an array
// of offsets. Then the offsets are added in parallel to produce the string "World!"
// By Ingemar Ragnemalm 2010
#include <stdio.h>
const int N = 7;
const int blocksize = 7;
#include <mpi.h>
#include <stdio.h>
#include <string.h>
int main (int argc, char **argv) {
int rank, size, partner;
int namelen;
char name[MPI_MAX_PROCESSOR_NAME];