Skip to content

Instantly share code, notes, and snippets.

View psteinb's full-sized avatar

Peter Steinbach psteinb

View GitHub Profile
@psteinb
psteinb / gist:bc52a4820b1ed743d8dd8c4d24524b7c
Created April 25, 2024 12:14
Running a CUFFT fft transform with callback
import cupy as cp
import cupyx.scipy.fft as cufft
import pytest
import numpy as np
import scipy.fft
scipy.fft.set_global_backend(cufft)
@pytest.fixture
def callbacks():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@psteinb
psteinb / random-survival-forest-shap.ipynb
Last active January 7, 2024 14:01
Example on how to use shap for sksurv's random survival forest
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@psteinb
psteinb / test_bench_brutenn.py
Created November 4, 2020 11:46
Benchmarking ann-benchmarks bruteforce NN versus sklearn's bruteforce NN implementation
#Python 3.9.0 | packaged by conda-forge | (default, Oct 14 2020, 22:59:50)
#[GCC 7.5.0] on linux
#sklearn.__version__ 0.23.2
#numpy.__version__ 1.19.2
#pytest.__version__ 6.1.2
#pytest_benchmark.__version__ 3.2.3
from brutenn.bruteforce import BruteForceBLAS
import numpy as np
from numpy.random import default_rng as drng
@psteinb
psteinb / osu_bibw.c
Created May 3, 2019 08:34
adding a simple check of the transmitted data to osu_bibw
#define BENCHMARK "OSU MPI%s Bi-Directional Bandwidth Test"
/*
* Copyright (C) 2002-2019 the Network-Based Computing Laboratory
* (NBCL), The Ohio State University.
*
* Contact: Dr. D. K. Panda (panda@cse.ohio-state.edu)
*
* For detailed copyright and licensing information, please refer to the
* copyright file COPYRIGHT in the top level OMB directory.
*/
@psteinb
psteinb / mnist_cnn.py
Created October 9, 2018 09:59
tf timeline record with tf 1.11 and keras 2.2.4
'''Trains a simple convnet on the MNIST dataset.
Gets to 99.25% test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
from __future__ import print_function
import keras
from keras.datasets import mnist
@psteinb
psteinb / Makefile
Created April 7, 2017 13:30
integer arithmetic bug in CUDA 8.0.44 and 8.0.51
NVCCFLAGS=-lineinfo
SM_FLAGS?=-gencode arch=compute_60,code=sm_60
all : works fails
works : reproduce.cu
nvcc $< $(NVCCFLAGS) -o $@
fails : reproduce.cu
nvcc $< $(NVCCFLAGS) $(SM_FLAGS) -o $@
/**
* Vector addition: C = A + B.
*
* This sample is a very basic sample that implements element by element
* vector addition. It is the same as the sample illustrating Chapter 2
* of the programming guide with some additions like error checking.
*/
#include <stdio.h>
@psteinb
psteinb / ffmpeg_roundtrip.c
Created August 12, 2015 15:06
Setting up a HEVC roundtrip with ffmpeg
#include <math.h>
#include <libavutil/opt.h>
#include <libavcodec/avcodec.h>
#include <libavutil/channel_layout.h>
#include <libavutil/common.h>
#include <libavutil/imgutils.h>
#include <libavutil/mathematics.h>
#include <libavutil/samplefmt.h>
@psteinb
psteinb / gist:a822fbec3f62b35f3282
Created January 15, 2015 12:41
indico fails upon login through LDAP
excerpt from indico.log:
2015-01-15 11:51:40,939 indico.requestHandler: INFO - Request <IndicoRequest 'https://indico.mpi-cbg.de/indico/user/login' [POST]> finished with TypeError: "bind_s() argument after * must be a sequence, not NoneType"
2015-01-15 11:52:56,844 indico.wsgi : ERROR - Connection unexpectedly closed
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10-py2.7.egg/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/dist-packages/indico-1.2-py2.7.egg/indico/web/flask/util.py", line 87, in wrapper
return obj(None).process(params)