Welding Triangles In A Mesh Using Thrust 2016-02-29

This algorithm is designed to weld together triangle vertices with a certain tolerance and remove duplicated triangles. Thrust will be used making the algorithm parallel on the CPU using OpenMP or on the GPU using CUDA. Additionally, I assume that the code is run on the CPU.

This example is based on the Welding Vertices example in the Thrust GitHub examples folder. I used the following to merge vertices and triangles for a marching cubes code which generated an unoptimized triangle mesh.

Input:

The input to this procedure is a list of triangles and vertices, vertices is a three dimensional vector with the locations of each vertex in a triangle and indices is an array of indices for the vertices that make up a specific triangle. Note that the input to the algorithm must not be merged already, meaning that vertices will contain unique entries for every vertex and indices will reference 3 unique vertices. No vertex will be shared by a triangle.

Jekyll Github Hook 2016-02-26

There are a few scripts online that will launch a script when a Github Webhook is activated. I found that Hookshot was the simplest and most customizable way to do what I wanted. It is a simple library that will handle

Setting up the Webhook

npm install -g hookshot

It can be used to execute scripts or commands when a specific branch in a repository is pushed to, in this example port 8080 is where the github hook is sent to.

hookshot -p 8080 -r refs/heads/master 'path_to_custom_script.sh'

Hookshot can also be configured to run using forever by using the js interface:

//hookshot.js:
#!/usr/bin/env node
var hookshot = require('hookshot');
hookshot('refs/heads/master', 'path_to_custom_script.sh').listen(8080)

Vectorized Math Libraries 2015-12-12

A list of vectorized math libraries I found so far, documenting here for future reference

Name License Hardware Targets
VCL GPLv3 SSE*, AVX, AVX2, AVX-512, FMA3, FMA4, XOP
VOLK GPLv3 SSE*, AVX, NEON
Vc BSD SSE*, AVX
libsimdpp Boost SSE2+, AVX, AVX2, FMA, AVX-512, NEON
Yeppp! BSD3 SSE*, AVX, AVX2, FMA, NEON, NEONv2
Ne10 BSD3 NEON
Vector math library BSD3 SSE2, PPU, SPU
SIMD Vector Library and Numerical Kernels FreeBSD SSE*, AVX, MIC, NEON
vectorial BSD2 SSE, NEON
vecmathlib MIT SSE, AVX, MIC, NEON, VSX, QPX
GLM MIT SSE2+, AVX,
Libm AMD AVX, FMA3, FMA4, XOP
Intel IPP proprietary SSE*, AVX, AVX2, AVX-512
Sleef None SSE2+, AVX, AVX2, FMA4, NEON
eigen3 MPL2 SSE*, AVX, FMA, VSX, NEON

PovRay Reference 2015-11-04

This post will cover many things that I have learned over the years using povray. The goal is to keep things simple and generate nice looking renders without too much complexity. I will also cover how to load simulation data for rendering.

Radiosity

When using radiosity I do not put in any extra light sources, povray describes this as Radiosity without conventional lighting. I find that this creates cleaner looking renders. In some cases where hard shadows are required or you want to have fine control over lighting you can add lights as needed.

Radiosity References

I usually start with the flowing settings and tweak from there. For most scenes I use a brightness value of 2.0 or 2.5 as there are no extra lights. Tweaking gray_threshold can be useful if you have bright objects and are getting too much color bleed.

#include "rad_def.inc"
// radiosity (global illumination) settings
global_settings { 
	radiosity{
	Rad_Settings(Radiosity_OutdoorHQ, off, off)
	//Increase object brightness (default 1.0)
	brightness 2.0
	// values < 1.0 reduce the influence of colors on indirect light (aka color bleed)
	gray_threshold 1.0 
	}
}
//Create a white background to add env lighting
background { color rgb<1,1,1>  }

CMake, CUDA Separable Compilation Error "relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC" 2015-10-22

When using CUDA separable compilation in newer versions of CUDA (> 5.0) I was getting the following error. Note that I am using CMake to generate my Makefiles

relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC

Most resources I found told to add the “–compiler-options -fPIC” option to NVCC

SET(CUDA_SEPARABLE_COMPILATION ON)
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; --compiler-options -fPIC)

But this did not fix the problem, it turns out that in CMake versions prior to 3.2 there is a bug in the way that separable compilation is handled with CUDA. Unfortunately the version of CentOS that we run on our cluster does not had a newer version of CMake available in the default repository. My crude fix was to compile CMake manually and install it to ~/bin/ in my home directory.

Wanted to document it here for future reference, it was not immediately apparent that it was a CMake issue.

References