Skip to content

Instantly share code, notes, and snippets.

View manodeep's full-sized avatar
👋

Manodeep Sinha manodeep

👋
View GitHub Profile
@manodeep
manodeep / benchmark
Last active August 29, 2015 14:10
Wrapper C code to run the various optimizations outlined here http://blogs.msdn.com/b/oldnewthing/archive/2014/12/01/10576992.aspx
################################################################################################################################################################################################
# Function compiler -O0 -O3 -O3 -Ofast -O3 -funroll-loops -O3 -Ofast -funroll-loops -O3 -Ofast -funroll-all-loops
################################################################################################################################################################################################
countthem gcc 1.000x 1.000x 1.000x 1.000x 1.000x 1.000x
countthem_ternary gcc 1.669x 3.614x 4.397x 5.271x 6.009x 6.399x
countthem_simd gcc 3.414x
@manodeep
manodeep / Latest timings
Last active January 25, 2019 04:57
Benchmarking Pairwise Separation Codes
## Timings with halotools v0.4 and Corrfunc v2.0.0. Updated on Sep 12 (random data, Corrfunc compiled with gcc6.0)
## Note this test is capped at 1 million because the first three codes take too long and halotools randomly subsamples
## particles above 1 million. The algorithm in halotools is an *exact* copy of `Corrfunc` - so the timing comparison simply
## tests the capability of the cython compiler.
## Timings generated on Oct 17, 2016, with mostly ready version of Corrfunc v2.0. Non-periodic calculations with random points.
## Npts kdcount cKDTree KDTree halotools Corrfunc(AVX) Corrfunc(SSE42) Corrfunc(fallback)
10000 0.039 0.057 0.087 0.026 0.240 0.053 0.052
50000 0.381 0.399 0.936 0.121 0.226 0.224 0.214
# encoding=utf-8
# para_async.py
import asyncio
import itertools
import aiohttp
@asyncio.coroutine
async def download(url, parts):
@manodeep
manodeep / test_wp_and_xi.py
Last active June 9, 2016 01:33
Testing module with Corrfunc for halotools
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, absolute_import,
unicode_literals)
import numpy as np
from Corrfunc._countpairs import countpairs_wp as wp
from Corrfunc._countpairs import countpairs_xi as xi
@manodeep
manodeep / test_gridlink_bug.py
Created August 24, 2016 00:58
Testing gridlink bug for issue #70
@manodeep
manodeep / test_npibins_bug.py
Created October 28, 2016 23:06
Corrfunc npibins bug (issue #96)
from __future__ import print_function
import numpy as np
from Corrfunc.mocks import DDrppi_mocks
from Corrfunc.io import read_catalog
from Corrfunc.utils import convert_rp_pi_counts_to_wp
from Corrfunc.utils import convert_3d_counts_to_cf
import Corrfunc
from os.path import dirname, abspath, join as pjoin
from IPython.core.debugger import Tracer
@manodeep
manodeep / benchmark_fast_hist.py
Created July 25, 2017 03:36
Benchmark my fork of Tom Robitaille's fast-histogram code
from __future__ import print_function
import numpy as np
from fast_histogram import histogram1d, histogram1d_wrapper
np.random.seed(42)
npoints=np.array([1, 10, 100])*1000000
for n in npoints:
x = np.random.random(n)
_ = histogram1d_wrapper(x, range=[-1, 2], bins=30)
@manodeep
manodeep / scrape.py
Created March 16, 2018 04:51
Example code to scrape the CAS colloquia page
def check_quantity_has_only_one_element(list_of_quant):
values = []
for val, name in list_of_quant:
try:
if len(val) > 1:
msg = "{0} must be a scalar quantity or an 1-element array.\n"\
"Found = {1} instead".format(name, val)
v = val[0]
except TypeError:
# scalar quantity has no len
@manodeep
manodeep / avx512_calls.c
Last active May 2, 2018 15:24
Simple AVX512F kernel
const int64_t bits_set_in_avx512_mask_float[] = { B16(0) };
const uint16_t masks_per_misalignment_value_float[] = {0b1111111111111111,
0b0000000000000001,
0b0000000000000011,
0b0000000000000111,
0b0000000000001111,
0b0000000000011111,
0b0000000000111111,
0b0000000001111111,
0b0000000011111111,
@manodeep
manodeep / UKRSE-Workshop-2017-Lightning-Talk-Plotting-EOI-Survey.py
Created October 8, 2018 22:22
Jupyter Notebook for RSE Expression of Interest Survey
import seaborn as sns
import pandas as pd
import warnings
import matplotlib.pyplot as plt;
import matplotlib;
matplotlib.style.use('ggplot');
txtfile='RSE-EOI-survey-list-anonymized-v2.csv'
rse_df = pd.read_csv(txtfile,