Skip to content

Instantly share code, notes, and snippets.

View omarsamir27's full-sized avatar
🤔

Omar Mohamed Samir omarsamir27

🤔
View GitHub Profile
@omarsamir27
omarsamir27 / pi_MPI.cpp
Created January 21, 2023 00:31
Example usage of MPI to calculate the value of pi
#include <iostream>
#include <mpi.h>
#include <iomanip>
/* This program approximates the value of pi using the Leibniz formula.
The Leibniz formula for pi [1] is attributed to Gottfried Wilhelm
Leibniz (1646-1716) . The formula goes as follows:
1 - 1/3 + 1/5 - 1/7 + 1/9 - ... = pi/4
This is an MPI implementation, MPI (Message Passing Interface) is a C API for multiprocessing ,
it works for multicore , multiprocessor and multi-node setups.
@omarsamir27
omarsamir27 / cuda_matrix_multiply.cu
Created January 21, 2023 00:29
Example code to demonstrate matrix multiplication of any appropriate dimensions using CUDA
#include <iostream>
/* Example code to demonstrate matrix multiplication of any appropriate dimensions using CUDA
* Matrix Multiplication is a routine operation in any BLAS Library , see https://docs.nvidia.com/cuda/cublas/index.html
* Before working with CUDA , it is advisable to go over the CUDA Documentation :
* https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html
* Author : Omar Mohamed <omarmsamir27@gmail.com> <github.com/omarsamir27>
* for HPC Centre in Alexandria Library <https://hpc.bibalex.org> <github.com/hpcalex>
*/