Skip to content

Instantly share code, notes, and snippets.

View SimeonEhrig's full-sized avatar

Simeon Ehrig SimeonEhrig

  • Dresden
View GitHub Profile
@SimeonEhrig
SimeonEhrig / mycd.sh
Last active August 28, 2019 09:29
wrapper script for cd (change directory) to simplify the cd ../../../.. statement
#!/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 / stdin_clang.sh
Last active August 28, 2019 09:30
Use stdin as input for the clang.
echo "int foo() { return 3;}" | clang++ -cc1 -
@SimeonEhrig
SimeonEhrig / singularity_cheat_sheet.md
Created August 28, 2019 09:38
Cheat Sheet for Singularity (and Docker) recipe

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 / cling_redefinition.md
Created October 14, 2019 11:27
Cling Redefinition

How to enable

[cling]$ #include "cling/Interpreter/Interpreter.h"
[cling]$ gCling->allowRedefinition();
[cling]$ gCling->isRedefinitionAllowed();

About

root-project/root#4214

@SimeonEhrig
SimeonEhrig / clingArgs.md
Last active November 13, 2019 08:39
Get arguments of a cling interpreter instance with reflection

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
@SimeonEhrig
SimeonEhrig / docker_cuda_gcc_version.md
Created December 18, 2019 09:49
Note, which nvidia docker image use which gcc version
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
@SimeonEhrig
SimeonEhrig / cling_get_module.cpp
Last active June 8, 2022 07:43
C++ code to view LLVM IR code of a statement in cling
#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 / create.sh
Created July 28, 2022 08:01
Creating the dependency graph from a CMake project
# go to build directory
# expect, that the cmake configure step is already done in the build folder
cd build
# create extra folder, because a lot of files will be created
mkdir graph
cmake . --graphviz=graph/app.dot
cd graph
# render dot file to svg
dot -Tsvg app.dot -o app.svg
@SimeonEhrig
SimeonEhrig / conda_spack.md
Last active October 10, 2022 08:14
Integrate Spack modules in conda environment.

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