Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcel R. riga

View GitHub Profile
@riga
riga / README.md
Last active Mar 29, 2021
Files and scripts required for CMS TDR documents on Overleaf
View README.md

CMS TDR documents on Overleaf

This gist demonstrates how to prepare CMS TDR documents to work on Overleaf.

All of the following files should be copied to the root directory of your project:

  • build.sh: Compiles the document once and saves a tex document (and the current pdf) to a new directory, named "overleaf" by default, which can be used as a root document on Overleaf. Please note that changes to this document get lost once this build script is executed again.
  • build_docker.sh: Executes the build script in a docker container using the official tdr build image.
  • latexmkrc: Tells the LaTeX compiler on Overleaf where to find the tdr tool.
@riga
riga / law_root_examples.py
Created Jan 7, 2021
Working with ROOT files in law.
View law_root_examples.py
# coding: utf-8
# This script showcases a few examples on how to simplify working with ROOT objects within law.
#
# Scope:
# 1. Usage of the low-level GuardedTFile
# 2. Reading and writing ROOT files via target formatters
# 3. Merging ROOT files with hadd_task
import law
@riga
riga / tf_times_two.py
Last active Aug 6, 2020
Example gist to showcase the cms_gist_runner.
View tf_times_two.py
# coding: utf-8
"""
Example gist to be used with the cms_gist_runner. Execute via
> ~mrieger/public/bin/cms_gist_runner 522d2d08dab617a46444213fe202d919 -v CMSSW_11_1_2 -t
"""
import tensorflow as tf
@riga
riga / custom_rise.css
Last active Jul 10, 2020
Custom CSS for RISE presentations
View custom_rise.css
body.rise-enabled div.prompt_container {
background-color: red !important;
}
div#notebook {
background-color: green !important;
}
View progress_tasks.py
# coding: utf-8
"""
Command to run the tasks:
luigi --module progress_tasks TaskB --workers 2
"""
import time
import luigi
@riga
riga / slurm_test.py
Last active Mar 4, 2020
Law slurm submission test
View slurm_test.py
# coding: utf-8
import time
import law
def test_htcondor():
# load the htcondor contrib package, making all exported objects available under law.htcondor
@riga
riga / testDeepJetPerformance.cc
Last active Feb 4, 2020
CMS DeepJet performance test between TF and ONNX
View testDeepJetPerformance.cc
/*
* Performance test of the DeepJet model with both TensorFlow and ONNXRuntime.
* Place this file into a cmssw test directory and add the following to the BuildFile.xml:
*
* <bin name="testTFDeepJetPerformance" file="testRunner.cpp,testDeepJetPerformance.cc">
* <use name="cppunit" />
* <use name="FWCore/Utilities" />
* <use name="PhysicsTools/TensorFlow" />
* <use name="PhysicsTools/ONNXRuntime" />
* </bin>
@riga
riga / cmssw_tf_thread_pools.h
Last active Jan 28, 2020
Custom CMSSW TF ThreadPools
View cmssw_tf_thread_pools.h
// custom TensorFlow ThreadPool implementations for CMSSW
#include "tensorflow/core/lib/core/threadpool.h"
#include "tbb/task_arena.h"
#include "tbb/task_group.h"
// thread pool that schedules all tasks within the caller thread
class NoThreadPoolImpl : public tensorflow::thread::ThreadPoolInterface {
public:
@riga
riga / pyrefs.py
Created Jan 22, 2020
Python reference count manipulation
View pyrefs.py
# coding: utf-8
import sys
import gc
import ctypes
# configuration of Py_IncRef and Py_DecRef
_c_inc_ref = ctypes.pythonapi.Py_IncRef
@riga
riga / lbn_usage.py
Last active May 14, 2020
Minimal LBN example using TF 2 (https://github.com/riga/LBN)
View lbn_usage.py
# coding: utf-8
"""
This example demonstrates the usage of the LBN different approaches:
- TF eager mode
- TF AutoGraph
- Keras model / layer
"""
import numpy as np