Skip to content

Instantly share code, notes, and snippets.

View rejunity's full-sized avatar

Renaldas Zioma rejunity

View GitHub Profile
@rejunity
rejunity / TGSM_bank_conflicts.py
Last active October 28, 2019 15:29
Python script to detect Thread Group Shared Memory bank conflicts
# Script to detect bank conflicts in Thread Group Shared Memory
# Supports optional Multicast (default: On), variable wave (default: 32) and bank count (default: 32)
# bank_conflicts(ptrs, wavesize=32, banks=32, multicast=True):
# Use:
# np.sum(bank_conflicts([thread.x*8 for thread in thread_group(8,8)]))
# np.sum(bank_conflicts([thread.id*2 for thread in thread_group(64)]))
# Conflicts per wave by bank number:
# bank_conflicts([thread.x*8 for thread in thread_group(8,8)])
@rejunity
rejunity / recipe_for_Unity_on_AWS.sh
Last active October 1, 2021 11:30
How to run Unity standalone on Amazon AWS Cloud
# Recipe on running Unity (or any OpenGL based application) on Amazon Cloud EC2
# Requirement: Instance with GPU (g2 or p2) and Ubuntu14.04
# Tested on g2.2xlarge with Ubuntu14.04.
# Summary: install NVIDIA driver, configure virtual display, patch configuration, run X server and your application
# Also see: https://askubuntu.com/questions/429596/how-to-choose-the-vga-when-setting-up-the-x-server/534622#534622
# prerequisites
sudo apt-get update
sudo apt-get install -y gcc make linux-generic
@rejunity
rejunity / recipe_for_Unity_offscreen.sh
Last active November 18, 2022 02:22
How to run Unity standalone application "offscreen" on Linux
# Recipe on running Unity (or any OpenGL based application) offscreen on your local Linux machine.
# Requirement: X server, NVIDIA drivers installed and working correctly.
# Tested on Ubuntu14.04.
# Summary: install XDummy and VirtualGL, configure virtual framebuffer, run your application via VirtualGL
# install XDummy
sudo apt-get update
sudo apt-get install xorg-video-abi-15 xserver-xorg-video-dummy
@rejunity
rejunity / recipe_for_Unity_headless.sh
Last active May 11, 2022 03:43
How to run Unity standalone application on a "headless" (w/o monitor) Linux box locally
# Recipe on running Unity (or any OpenGL based application) on Linux machine without monitor.
# Requirement: NVIDIA drivers installed and working correctly.
# Tested on Ubuntu14.04.
# Summary: configure virtual display, run X server and launch your application on the same display as X.
# install X server
sudo apt-get install xserver-xorg
# configure virtual display device for X server
@rejunity
rejunity / histogram_loss.py
Created April 16, 2017 07:19
Histrogram style loss based on "Stable and Controllable Neural Texture Synthesis and Style Transfer Using Histogram Losses" (4.3)
# output -- per layer feature-map of the image we optimize
# style -- per layer feature-map of the style image we want to copy
# histogram_matching() -- see reference numpy implementation http://stackoverflow.com/a/33047048/7873678
output_remapped = histogram_matching(output, style, nbins=1024) # non-differentiable
sum((output_image - output_remapped)**2) # gradients assume that output_remapped ~~ const
@rejunity
rejunity / gist:7bd0f1fa4a0014ef26c097225dc62fc0
Last active May 9, 2017 06:28
Compile and run OpenSWR on AWS Instance (Ubuntu 14.04)
# Recipe on compiling and running OpenSWR on AWS Instance (Ubuntu 14.04)
# Questions regarding this recipe: @__rej__
# http://openswr.org
# prerequisites
sudo apt-get update
sudo apt-get install git
sudo apt-get install build-essential