Below you will find a list of programs free to download and use to generate and process GERLUMPH magnification maps.Each code is accompanied by a description and examples of how to use it.Please make sure to credit the correct person that developed the code and/or associated publication.


GPUD Direct ray-shooting code on the GPU
gerlumph++ A C++ library for microlensing analysis
causticfinder An analytic method to find caustics


Generating microlensing magnification maps on the GPU

This is a GPU-accelerated implementation of the inverse ray-shooting technique, used to generate cosmological microlensing magnification maps. These maps (see an example here) approximate the source plane magnification patterns created by an ensemble of stellar-mass compact objects within a foreground macrolens galaxy.


The code performs the following programming tasks:

  1. A number of microlenses (see equation 5 of Bate et al., 2010) is generated on the CPU (black dots on the Figure), and the associated memory is passed on to the GPU.
  2. A large number of light ray positions (~108) is generated on the CPU (grey and red dots on the Figure), and then passed on to the GPU.
  3. Each light ray is deflected by each microlens using the gravitational lens equation (see equation 4 of Bate et al., 2010). This is where we have implemented our GPU brute-force solution.
  4. The positions of the deflected light rays are mapped onto the source plane and binned in to pixels (red dots on the Figure).
  5. The process repeats from step 2, until a sufficiently large number of rays is located within the magnification map (~1010).

More details can be found in the following papers:

schematic representation of the ray shooting technique

Figure: A schematic representation of the direct inverse ray-shooting technique (from Vernardos & Fluke, 2014). The microlenses are distributed in the lens plane (black dots), where also a grid of light rays (grey and red dots) is set. The positions of the deflected rays in the source plane are mapped and binned into pixels (red dots).

Technical specifications

As our GPU-D code uses CUDA for GPU acceleration, it can only run on NVIDIA devices. Currently, we have tested the code with CUDA 4.0, 4.1, 4.2 and 5.0. Here is the command used to compile the code:

nvcc -D_DEBUG -lgomp -arch=compute_11 --compiler-options "-fno-strict-aliasing -Wall -fopenmp" -O3 -o lenser_gpu lensDriver.cpp lensFuncs.cpp help.cpp

And here is an example execution call:

./lenser_gpu -k 0.45 -g 0.2 -navg 100 -res 1024

The resulting output map (described below) is included in the download package for comparisons. Executing the code without any options will print a help text explaining each command line argument.


map.bin: the ray-counts per map pixel, represented by a 32-bit integer written in binary format. The size of the file (in Megabytes) can be easily calculated by applying the following formula: 4 x resolution2/10242. The output can be viewed by appropriate programs e.g. od -t d4 map.bin | head in Unix.
The order of the pixels...

mapmeta.dat: properties of the produced magnification map stored in text format for quick access. These are the average magnification, <μ>, the average number of rays per pixel, <N>, the resolution, the map width, and the κ,γ,s values used. One can convert the ray-counts to magnification using the following formula: μ = N <μ>/<N>.

lens_pos.dat: mass (in M) and position coordinates of the microlenses on the lens plane, stored in text format.


Microlensing analysis with magnification maps

Coming soon...


Finding caustics and critical curves

Coming soon...