Skip to content

Instantly share code, notes, and snippets.

View barche's full-sized avatar

Bart Janssens barche

View GitHub Profile
### A Pluto.jl notebook ###
# v0.14.2
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
@barche
barche / test.jl
Created April 14, 2020 23:16
Example on mapping templated types that are not POD
module OpenCV
using CxxWrap
struct Point{T}
x::T
y::T
end
@wrapmodule "build/lib/libtestlib.so"
@barche
barche / config-trilinos.sh
Created August 11, 2018 10:28
Config file for Trilinos
#!/bin/bash
sourcedir=$HOME/src/trilinos
instdir=$HOME/src/build/trilinos-install
CC=mpicc
CXX=mpic++
FC=mpif77
ccmake -D CMAKE_INSTALL_PREFIX:PATH=$instdir -D CMAKE_BUILD_TYPE:STRING=RELEASE \
@barche
barche / add_cuda.jl
Last active November 30, 2017 06:46
Julia implementation of https://devblogs.nvidia.com/parallelforall/unified-memory-cuda-beginners/, first using pointers and then using a custom `UnifiedArray` type.
# Version using only CUDAdrv
using CUDAdrv, CUDAnative
using BenchmarkTools
const N = 1000000
function kernel_init(A, B, numElements)
i = (blockIdx().x-1) * blockDim().x + threadIdx().x
if i <= numElements
@barche
barche / cartesian-grid.cpp
Created April 25, 2017 19:55
Julia vs C++
// compile with either:
// clang++ -std=c++11 -O2 cartesian-grid.cpp -o cartesian-grid
// g++ -std=c++11 -O2 cartesian-grid.cpp -o cartesian-grid
#include <chrono>
#include <iostream>
#include <vector>
typedef double scalar_t;
typedef int64_t idx_t;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.