Skip to content

Instantly share code, notes, and snippets.

Avatar

Simeon Ehrig SimeonEhrig

  • Dresden
View GitHub Profile
@SimeonEhrig
SimeonEhrig / conda_spack.md
Last active Jun 24, 2020
Integrate Spack modules in conda environment.
View conda_spack.md

About

Automatic loading of Spack modules when the Conda environment is loaded.

Helper function

Spack and Conda can influence each other with side effects. Therefore I do not activate them by default. The following functions allow you to activate Conda and Spack by bash command.

# for example, add to .bashrc
@SimeonEhrig
SimeonEhrig / docker_cuda_gcc_version.md
Created Dec 18, 2019
Note, which nvidia docker image use which gcc version
View docker_cuda_gcc_version.md
image name GCC version
nvidia/cuda:8.0-devel-ubuntu16.04 5.4.0 20160609
nvidia/cuda:9.0-devel-ubuntu16.04 5.4.0 20160609
nvidia/cuda:9.1-devel-ubuntu16.04 5.4.0 20160609
nvidia/cuda:9.2-devel-ubuntu16.04 5.4.0 20160609
nvidia/cuda:10.0-devel-ubuntu18.04 7.4.0
nvidia/cuda:10.1-devel-ubuntu18.04 7.4.0
nvidia/cuda:10.2-devel-ubuntu18.04 7.4.0
View cling_redefinition.md
@SimeonEhrig
SimeonEhrig / singularity_cheat_sheet.md
Created Aug 28, 2019
Cheat Sheet for Singularity (and Docker) recipe
View singularity_cheat_sheet.md

cheat sheet for different container snippets

cuda docker sources

Sometimes the PATH and LD_LIBRARY_PATH are not set correctly for the CUDA installation

	export PATH=$PATH:/usr/local/cuda/bin/
	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib6
@SimeonEhrig
SimeonEhrig / mycd.sh
Last active Aug 28, 2019
wrapper script for cd (change directory) to simplify the cd ../../../.. statement
View mycd.sh
#!/bin/bash
# wrapper for the cd command
# it expands sequence .... to ../../../../ (each dot becomes a ../ )
# example: ' cd .... ' -> ' cd ../../../../ '
# if the command does not match ' cd ..[.]+ ' , it is passed directly to the cd command
# alias cd=". /path/to/mycd.sh"
if [[ $# != 1 ]]; then
@SimeonEhrig
SimeonEhrig / cling_get_module.cpp
Last active Oct 7, 2019
C++ code to view LLVM IR code of a statement in cling
View cling_get_module.cpp
#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/Transaction.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/raw_ostream.h"
auto T1 = gCling->getLatestTransaction();
// command
T1->getNext()->dumpPretty();
T1->getNext()->getModule()->print(llvm::outs(), nullptr);
@SimeonEhrig
SimeonEhrig / stdin_clang.sh
Last active Aug 28, 2019
Use stdin as input for the clang.
View stdin_clang.sh
echo "int foo() { return 3;}" | clang++ -cc1 -
@SimeonEhrig
SimeonEhrig / clingArgs.md
Last active Nov 13, 2019
Get arguments of a cling interpreter instance with reflection
View clingArgs.md

To get the arguments of cling, which are passed on start, you can use the reflection feature of cling.

#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/InvocationOptions.h"

// gCling is an object of type cling::Interpreter
std::vector<const char*> remaining = gCling->getOptions().CompilerOpts.Remaining;
remaining