Skip to content

Instantly share code, notes, and snippets.

View Rod-Persky's full-sized avatar

Rod Persky Rod-Persky

View GitHub Profile
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
@Rod-Persky
Rod-Persky / CMakeLists.txt
Last active January 31, 2024 12:57
Example cmake for windows including auto copy dll
# _______ __ __ _______ ______ _______ _______ _______ ______ #
#| || | | || || | | _ || || || | #
#| _ || | | ||_ _|| _ || |_| ||_ _|| ___|| _ |#
#| | | || |_| | | | | | | || | | | | |___ | | | |#
#| |_| || | | | | |_| || | | | | ___|| |_| |#
#| || | | | | || _ | | | | |___ | |#
#|_______||_______| |___| |______| |__| |__| |___| |_______||______| #
# #
# Modern CMake practices and importing the QT scripts by adding it to #
# your module path makes things a lot better than it used to be #
@Rod-Persky
Rod-Persky / vector_reduce.c
Created October 6, 2014 11:05
Pure C vector reduce
int step_8 = size / 8; int step_8_r = size % 8;
int step_4 = step_8_r / 4; int step_4_r = step_8_r % 4;
int step_2 = step_4_r / 2; int step_2_r = step_4_r % 2;
double value = inital_value;
for (int step_n = 0; step_n < step_8; step_n++){
int offset = 8 * step_n;
__m256d a = _mm256_set_pd(values[offset], values[offset + 1], values[offset + 2], values[offset + 3]);
__m256d b = _mm256_set_pd(values[offset + 4], values[offset + 5], values[offset + 6], values[offset + 7]);
__m256d sum = _mm256_hadd_pd(a, b);
@Rod-Persky
Rod-Persky / build_openfoam.pbs
Last active December 30, 2015 10:39
OpenFOAM Build Script
#!/bin/bash -l
#PBS -S /bin/bash
####### RESOURCES SETUP #######
#These commands set up the Grid Environment for your job:
# -N [Job Name]
# -l nodes=[number of cores]
# -l ncpus=[number of cpus required]
# -l mem=[amount of memory required]
# -l walltime=[how long the job can run for]
# -m ae = mail on (a)bort and (e)rror