Wiki
Clone wikiMacroSim / Home
Welcome to ITO-MacroSim
MacroSim is ITOs open source, GPU accelerated ray tracing engine. Originally developed for fast non-sequential stray light analysis of a spectrometer system [1], it offers the possibility to trace geometric rays sequentially and non sequentially with 64 bit floating point precision. Both tracing modes are fully parallelized either using a variable number of CPU cores or the massively parallel thread units of any nVidia graphics board with compute capability 1.1 or higher. Depending on the specifics of the optical system, that is being analyzed, acceleration factors of up to 100 have been observed comparing the tracing time of the GPU-mode to the CPU-mode [2]. We provide Open Source access under the GPL license to the source code here. The source code is organized into two main projects. The first project encapsulates the actual tracing engine, that can either be compiled as an executable command line program or as a static library, that can be linked against a graphical user interface project. This GUI project (see figure 1 for a screenshot) is implemented as a dll for the open source measurement software project of the Institute for Technical Optics, that is called itom. In the meantime we provide a windows installer, that can be used for plugin development. The development of the tracer engine has been based on nVidias cross platform application acceleration engine OptiX. It should therefore be transferable to linux systems. However it has been developed and tested so far on Windows 7 64bit systems only. The GUI-dll as well as the itom software is based on Qt and is therefore platform independent as well. It has been developed and tested under Windows 7 32bit/64bit systems.
Within the GUI of MacroSim, Sources, Geometries and Detectors can be added to the optical scene by double clicking on the respective item in the library tree view on the left. Once added, the items of the scene are listed in the scene tree view on the right. The parameters of these items can be set via the property editor in the lower right after the respective item has been selected by double clicking in the scene tree view. All changes to the optical scene are displayed in real time in the central widget of the GUI. The item that is currently selected in the property editor is highlighted in green. Refracting materials in MacroSim can be parametrized either by directly entering its refractive indices or by specifying its name in a Zemax glass catalog, that can be loaded. After starting a simulation via the simulation menu or the run button in the tool bar, the optical scene is translated into a custom xml-format. This xml string is then passed to the tracing engine and the actual tracing is done in a separate thread. During the simulation, status messages of the tracing engine are printed to the status widget in the lower left of the GUI. The result of the simulation is returned as a data object to the itom software, where it can be further processed by means of the script language python3. If using the tracing engine as a standalone command line program, the xml description of the optical scene has to be provided via an appropriate file (the xml-file describing the lithography objective displayed in figure 1 can be viewed here as an example) and the result is stored into another file. MacroSim is a project under development. It is very likely that a lot of bugs are still present in the code and the results of the tracing are not guaranteed to be correct. However, everybody is encouraged to participate in further developing the software and to contribute to a platform independent, fast and freely accessible ray tracing program for optical design and simulation.
-
F. Mauch, D. Fleischle, W. Lyda, W. Osten, T. Krug, R. Häring, „Combining rigorous diffraction calculation and GPU accelerated nonsequential raytracing for high precision simulation of a linear grating spectrometer“, Proc. SPIE, 8083, 80830F-2 (2011).
-
F. Mauch, M. Gronle, W. Lyda, W. Osten, „Open-source graphics processing unit–accelerated ray tracer for optical simulation“, Optical Engineering, 52(5), 053004, 2013. (http://opticalengineering.spiedigitallibrary.org/article.aspx?articleid=1686673)
Getting a quick glimpse at MacroSim
The easiest and fastest way to take a look at MacroSim is to follow these steps:
-
Go install the 64 bit version of itom_1.0.14. You can use the itom_setup_win64_1.0.14_AllInOne.exe from https://sourceforge.net/projects/itom/files/.
-
Install the 64bit cuda toolkit 5.0 from https://developer.nvidia.com/cuda-toolkit-archive
-
unpack the MacroSimRelease_1.0.14_64bit.zip archive from the download section of this project.
-
follow the instructions in the readme, that is contained in the archive.
enjoy !!
Setting up the windows development environment for the tracing engine
-
install cuda toolkit 4.0.
-
Run CMake and browse for the source code of the tracing engine (e.g. C:\MacroSim\Tracer\src).
-
select a build directory (e.g. C:\MacroSim\Tracer\src\build64).
-
You need to add the include directory of our tracing engine to the include path of nvidias nvcc compiler. Therefore you have to add the entry I"E:\git-itom\src\MacroSim\Tracer\src\include" (note that the actual include path depends on where you cloned the repository onto your machine) to the CUDA_NVCC_FLAGS variable in the CUDA group of CMake.
-
click configure and chose your compiler (e.g. Visual Studio 10 Win64).
-
make sure you've selected BUILD_TARGET64 and CUDA_64_BIT_DEVICE_CODE if you compile for 64bit and click configure again.
-
CMake should be able to configure now. If not you may need to set the paths for fftw etc. manually.
-
once configuration was succesfull, click generate. In case of Visual Studio development, a solution file should have been created in your build directory. Open it and build the solution.
Setting up the windows development environment for the gui-project
-
Go get itom from https://bitbucket.org/itom/itom/wiki/Home. Install the application following the instructions on that site.
-
Clone this repository to your local hard disk.
-
get binaries of the third party libraries, that we could not include in our installer, i.e. download binaries of fftw-3.3.3 and glew-1.9.0.
-
download and install QT 4.8 from http://qt-project.org/downloads. Note that if you want to build for 64 bit you need to build Qt first, as precompiled are only available for 32bit.
-
create a system variable QTDIR directing to the installation folder of Qt (e.g. C:\Qt\4.8.2).
-
create a system variable QMAKESPEC and set it to win32-msvc2010 for compilation with microsoft visual studio 2010.
-
add %QTDIR%\bin as the first entry to your system path.
-
download and install OpenCV 2.4.6 superpack from http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3/.
-
add the binary folder to your system path (e.g. C:\OpenCV2.3\build\x64\vc10\bin).
-
download and install QScintilla2 from http://www.riverbankcomputing.co.uk/software/qscintilla/download
-
open the QScintilla.pro (e.g. in C:\QScintilla2\Qt4Qt5) file with your favourite text editor and the line "CONFIG += *" to "CONFIG += qt warn_off debug_and_release build_all dll thread".
-
Add the line "CONFIG(debug, debug|release) { TARGET = $$join(TARGET,,,d) }" after the config line in QScintilla.pro
-
If already existing, delete the folder Qsci from your QTDIR\include folder
-
If already existing delete the files qscintilla2.dll and qscintilla2d.dll from your QTDIR\bin folder
-
open the visual studio command line, go to C:\QScintilla2\Qt4Qt5 type "qmake qscintilla.pro", then "nmake" and finally "nmake install".
-
Finally copy the file qscintilla2.dll and qscintilla2d.dll from QTDIR\lib to QTDIR\bin
-
download and install cuda toolkit version 4.0 from https://developer.nvidia.com/cuda-toolkit-archive
-
Get the visualization toolkit vtk5.10.1. from http://www.vtk.org/VTK/resources/software.html
-
configure visualization toolkit using CMake. Make sure you select VTK_USE_QT in the VTK group.
-
Make sure to uncheck the BUILD_SHARED_LIBS option
-
if not existing, create a variable called CMAKE_DEBUG_POSTIFX and set it to -gd
-
Generate the project files for your favourite compiler and build vtk.
-
Run CMake and browse for the source code from your local repository folder (e.g. C:\MacroSim).
-
select a build directory (e.g. MacroSim_build64).
-
set the variable PTX_DIR to the correct directory. Usually it will be located at ../MacroSim/Tracer/build64/lib/ptx. But you can chose any folder you like when you are setting up the development environment of the tracer engine.
-
click configure and chose your compiler (e.g. Visual Studio 10 Win64).
-
Most likely you will be asked to give CMake the path to the itom-SDK. Browse for it in the path, you installed itom to (e.g. C:\ProgramFiles\itom\SDK).
-
make sure you've selected BUILD_TARGET64 and CUDA_64_BIT_DEVICE_CODE if you compile for 64bit and click configure again.
-
CMake should be able to configure now. If not you may need to set the paths for Qt, fftw, glew etc. manually.
-
once configuration was succesfull, click generate. In case of Visual Studio development, a solution file should have been created in your build directory. Open it and build the solution.
Run the tracer
-
Run itom
-
In the bottom right corner of the itom gui, you'll find an overview of the available plugins.
-
Expand the Algorithm tree and look for MacroSim.
-
Expand MacroSim tree, right click on its widget and select "Open Widget..."
Have fun!
Updated