Skip to content

Instantly share code, notes, and snippets.

View bast's full-sized avatar
🦀
rusting

Radovan Bast bast

🦀
rusting
View GitHub Profile
@bast
bast / ubuntu-dalton-gnu-openmpi
Created June 16, 2014 22:24
Complete installation walk through for Dalton 2013 with GNU and OpenMPI on Ubuntu 12.04 x86_64.
#!/usr/bin/env bash
# complete installation walk through for Dalton 2013 with GNU and OpenMPI on Ubuntu 12.04 x86_64
# ADAPT: location where we want Dalton installed
# we assume that the Dalton tarball is in there
DALTON_PATH=$HOME/dalton
# ADAPT: location where we want OpenMPI installed
OPENMPI_PATH=$HOME/openmpi
@bast
bast / virtualenv-ipython-bootstrap
Last active August 29, 2015 14:05
How to build ipython into venv out of almost nothing.
# Copyright (c) 2015 Radovan Bast
# Licensed under the MIT license - http://opensource.org/licenses/MIT
#------------------------------------------------------------------------------
# step 1: bootstrap a venv out of almost nothing
#------------------------------------------------------------------------------
# temporary directory, will be erased after we are done
TEMP_DIR=`mktemp -d`
@bast
bast / MPI-split-loop
Last active June 7, 2022 18:36
MPI: split loop with equal amount of work for each element among processes.
// Copyright (c) 2015 Radovan Bast
// Licensed under the MIT license - http://opensource.org/licenses/MIT
#include <stdio.h>
#include <mpi.h>
int main (int argc, char *argv[])
{
int rank, comm_size;
@bast
bast / amdahl.py
Last active April 2, 2017 03:35
Script to plot some Amdahl's law curves.
# Copyright (c) 2015 Radovan Bast
# Licensed under the MIT license - http://opensource.org/licenses/MIT
from pylab import *
def get_amdahl(p, n):
s = 1.0/((1.0 - p) + (p/n))
return s
@bast
bast / dalton_eurora.txt
Last active August 29, 2015 14:06
Dalton2014 compilation on EURORA.
# Copyright (c) 2015 Radovan Bast
# Licensed under the MIT license - http://opensource.org/licenses/MIT
module add gnu/4.6.3 cmake/2.8.10
module add intel mkl intelmpi
./setup --fc=mpiifort --cc=mpiicc --cxx=mpiicpc --mkl=parallel --omp
cd build
make
program shmem_mpi
! this is a hello world example based on code examples
! by Jeff Hammond and Jonathan Vincent (big thanks to them)
! in this example master allocates and fills an array with "twos" and then
! each rank prints the sum of all ements, each rank should print 200.0
use mpi
use, intrinsic :: iso_c_binding
@bast
bast / cuda
Last active August 29, 2015 14:10
Basic CUDA kernel construct.
// Copyright (c) 2015 Radovan Bast
// Licensed under the MIT license - http://opensource.org/licenses/MIT
__global__ void foo_kernel(int n,
                           double *a,
                           double *b,
                           double *c)
{
    int tid = threadIdx.x + blockIdx.x*blockDim.x;
@bast
bast / cowsay-cowntdown
Last active August 29, 2015 14:10
Cowsay release countdown.
#!/usr/bin/env python
# Copyright (c) 2015 Radovan Bast
# Licensed under the MIT license - http://opensource.org/licenses/MIT
import time
import calendar
import os
release_time = calendar.timegm(time.gmtime())
@bast
bast / heat.py
Last active August 29, 2015 14:14
Heatmap with PyLab.
# Copyright (c) 2015 Radovan Bast
# Licensed under the MIT license - http://opensource.org/licenses/MIT
import sys
import pylab as pl
file_name = sys.argv[1]
with open(file_name, 'r') as f:
lines = f.readlines()
@bast
bast / ubuntu-dirac-gnu-openmpi-int64
Last active November 14, 2015 21:48
Installation walkthru for DIRAC14 with GNU and OpenMPI (64bit-integers) on Ubuntu 14.04 x86_64.
#!/usr/bin/env bash
# complete installation walkthru for DIRAC14
# with GNU and OpenMPI (64bit-integers)
# on Ubuntu 14.04 x86_64
# Copyright (c) 2015 Radovan Bast
# Licensed under the MIT license - http://opensource.org/licenses/MIT
# ADAPT locations: