Skip to content

Instantly share code, notes, and snippets.

View ddemidov's full-sized avatar

Denis Demidov ddemidov

View GitHub Profile
@dcreager
dcreager / version.py
Created February 10, 2010 20:30
Extract a setuptools version from the git repository
# -*- coding: utf-8 -*-
# Author: Douglas Creager <dcreager@dcreager.net>
# This file is placed into the public domain.
# Calculates the current version number. If possible, this is the
# output of “git describe”, modified to conform to the versioning
# scheme that setuptools uses. If “git describe” returns an error
# (most likely because we're in an unpacked copy of a release tarball,
# rather than in a git working copy), then we fall back on reading the
# contents of the RELEASE-VERSION file.
@lilac
lilac / invert-matrix.cpp
Created April 22, 2012 14:54
Invert matrix by Boost uBlas
/*
The following code inverts the matrix input using LU-decomposition with backsubstitution of unit vectors. Reference: Numerical Recipies in C, 2nd ed., by Press, Teukolsky, Vetterling & Flannery.
you can solve Ax=b using three lines of ublas code:
permutation_matrix<> piv;
lu_factorize(A, piv);
lu_substitute(A, piv, x);
*/
@ddemidov
ddemidov / Makefile
Created June 13, 2012 18:38
Hello world in OpenCL
hello: hello.cpp
g++ -std=c++0x -o hello hello.cpp -lOpenCL
@ddemidov
ddemidov / Makefile
Created June 13, 2012 18:39
Hello world in VexCL
VEXCL_ROOT=/usr/include
hello: hello.cpp
g++ -std=c++0x -o hello hello.cpp -I$(VEXCL_ROOT) -lOpenCL -lboost_system
@ddemidov
ddemidov / Makefile
Last active August 29, 2015 13:57
Boost.PP parse parameter list
run:
@g++ -E pp.cpp | tail -n 1 | clang-format | pygmentize -l cpp
check:
@g++ -E pp.cpp
@jnothman
jnothman / forkme.svg
Last active November 17, 2021 05:08
"Fork me on GitHub" ribbon in LaTeX/TikZ vector graphic
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ddemidov
ddemidov / Makefile
Last active June 8, 2020 21:47
VexCL - OpenGL interaction
hello: hello.cpp
g++ -std=c++0x -O3 -o hello hello.cpp -I$(VEXCL_ROOT) \
-lGL -lglut -lGLEW -lOpenCL -lboost_system

Design

Boost.Compute provides a thin C++ wrapper around OpenCL host API at its core and builds a set of STL-like algorithms on top of that core. The user interface strongly resembles the STL and hence should be familiar to any C++ programmer.

The only minor problem I have with the design is the decision to provide another C++ wrapper for OpenCL host API instead of using the standard C++ bindings header [1] provided by the Khronos group (the body behind the OpenCL standard). This decision makes interaction with the existing OpenCL libraries

@ddemidov
ddemidov / hello.cpp
Created September 25, 2014 07:06
Backtrace
#include <iostream>
#include <vexcl/vexcl.hpp>
void bar() {
vex::Context ctx(vex::Filter::Env);
const size_t n = 1024;
vex::vector<int> x(ctx, n), y(ctx, n);
VEX_FUNCTION(int, baz, (int, idx),
return incomprehensible_gibberish(idx);
@ddemidov
ddemidov / output.txt
Last active April 5, 2023 14:36
PyAMG vs AMGCL
PyAMG
----------------
multilevel_solver
Number of Levels: 5
Operator Complexity: 1.338
Grid Complexity: 1.188
Coarse Solver: 'pinv2'
level unknowns nonzeros
0 1048576 5238784 [74.73%]