Skip to content

Instantly share code, notes, and snippets.

View cindytsai's full-sized avatar
🏡
Working from home

Shin-Rong Tsai cindytsai

🏡
Working from home
View GitHub Profile
@cindytsai
cindytsai / OneSideMPI.cpp
Last active September 14, 2021 08:04
OpenMPI RMA operation.
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
/**
* @brief OpenMPI RMA operation.
* @details Create two window with MPI_Win_create_dynamic, and attach two arrays
* with different data type to one window. Attach another array that has data overlapped
* with other array to different window or the same window will still work.
* Then use MPI_Get to perform RMA operation to get data from target rank.
@cindytsai
cindytsai / 2d-gradient.py
Last active May 1, 2022 09:27
Find gradient of function in 2-dim and 3-dim via FFT and via `np.gradient`. Then compare their results to analytic solution.
# Run with:
# >>> python 2d-gradient.py <num_sample in one direction> <padding zero>
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import sys
# Plot Settings
fig = plt.figure(figsize=plt.figaspect(0.5))
@cindytsai
cindytsai / Using_cProfile.md
Created June 19, 2022 10:22
How to use cProfile and visualize.

Using Profile Tools

cProfile

Implement in Inline Analysis

Use cProfile.runctx in a function specific for profiling.

import yt
import cProfile
from mpi4py import MPI

# Must include this line, if you are running in parallel.