Skip to content

Instantly share code, notes, and snippets.

Avatar

Eyal Rozenberg eyalroz

View GitHub Profile
@eyalroz
eyalroz / benchmark.cpp
Last active Apr 5, 2020
benchmarks for stackoverflow question 61047308
View benchmark.cpp
#include <geiger/geiger.h>
#include <cmath>
#include <cstdlib>
#include <string>
#include <iostream>
#include <random>
namespace aliberro {
@eyalroz
eyalroz / column-2019-03-27.md
Last active Jul 23, 2019
Better column abstraction in cudf - rejoinder 1
View column-2019-03-27.md

Rejoinder to the initial design document / proposal

These comments and questions follow this gist by Jacob Hemstad. They appear in order of the text in Jacob's gist. Please excuse the somewhat argumentative/critical tone - I'm actually very pleased that we are hammering this out.


We want to write an algorithm once and allow it to work on a variety of columns.

Well, yes, but aren't we doing that now already?

@eyalroz
eyalroz / limits.cuh
Created Oct 21, 2017
CUDA-compatible version of C++ <limits>
View limits.cuh
// CUDA-device-accessible version of gcc 4.9.3's <limits>. -*- C++ -*-
/*
* The C++ standard library's numeric_limits classes cannot currently be used
* in device code, since their methods are not marked __host__ __device__, and
* even though they're constexpr - CUDA 7.5 and earlier does not properly support
* using __host__ constpexr's on the device (there's experimental support but
* it causes trouble in different places).
*/
@eyalroz
eyalroz / get_cuda_sm.sh
Created Apr 15, 2017
Shell script for determining the SM value for your (single) GPU
View get_cuda_sm.sh
#!/bin/bash
#
# Prints the compute capability of the first CUDA device installed
# on the system, or alternatively the device whose index is the
# first command-line argument
device_index=${1:-0}
timestamp=$(date +%s.%N)
gcc_binary=${CMAKE_CXX_COMPILER:-$(which c++)}
cuda_root=${CUDA_DIR:-/usr/local/cuda}
View sgn2pdf
#!/bin/bash
#
# sgn2pdf
# by Eyal Rozenberg <eyalroz@technion.ac.il>
# version: 2016-12-27
#
# Extracts a PDF file from an Israeli courts' .sgn PDF document envelope
#
#
# This program is free software: you can redistribute it and/or modify
View memory_region.h
/**
* memory_region.h
*
* Definition of the gsl::span-like memory_region class
*/
#pragma once
#ifndef SRC_UTIL_MEMORY_REGION_H_
#define SRC_UTIL_MEMORY_REGION_H_
#if ( __cplusplus < 201103L )
View Factory.h
/**
* Implementation of the factory pattern, based on suggestions here:
*
* http://stackoverflow.com/q/5120768/1593077
*
* and on the suggestions for corrections here:
*
* http://stackoverflow.com/a/34948111/1593077
*
View Parsing the unparsed program_options options
static void add_unrecognized_options(TestConfiguration& config, const std::vector<string>& unrecognized_options)
{
// TODO: make sure all unrecognized options are of the form --option=value
// I'm sure the following can be made more elegant...
enum { OptionName, OptionValue } now_expecting = OptionName;
std::string option_name;
for(auto it = unrecognized_options.begin(); it != unrecognized_options.end(); it++) {
std::string option_value;
@eyalroz
eyalroz / static_block.h
Last active Mar 20, 2019
A static block implementation in almost-C C++
View static_block.h
/**
* static_block.h
*
* An implementation of a Java-style static block, in C++ (and potentially a
* GCC/clang extension to avoid warnings). Almost, but not quite, valid C.
* Partially inspired by Andrei Alexandrescu's Scope Guard and
* discussions on stackoverflow.com
*
* By Eyal Rozenberg <eyalroz@technion.ac.il>
*