Skip to content

Commit

Permalink
Release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ndoucet authored and Eduardo Gonzalez Fisher committed Nov 13, 2017
1 parent f4f8859 commit ffa729f
Show file tree
Hide file tree
Showing 65 changed files with 11,047 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.fits
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "cmake_modules/ecrc"]
path = cmake_modules/ecrc
url = https://github.com/ecrc/ecrc_cmake.git
30 changes: 30 additions & 0 deletions ATM_PARAM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Atmospheric parameters {#ATM_PARAM}
===================================

The parameter file is named "prof%d-atmos-night%d.txt", where the %d are integers representing:
* the index of the observation
* the index of the night

These files must contain the following parameters in this strict order.

Each parameter must be preceded by a blank line (used for comments).

* The number of layers
* r0 at wfs lambda
* profile strength (units as in E-SPE-ESO-276-0206_atmosphericparameters)
* altitude of layers (meters)
* outer scale (meters)

See an example below:
~~~{.txt}
Nlayer
10
r0 @ wfs lambda
0.128916
cn2 ESO units
16.1481 3.93694 3.15623 2.16198 1.04095 0.800734 0.867462 1.72825 0.411711 0.144132
h in meters
30 200 390 1880 4500 7500 10500 13500 16500 19500
l0 in meters
25 25 25 25 25 25 25 25 25 25
~~~
134 changes: 134 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
cmake_minimum_required(VERSION 3.2.3)


#set common absolute path
get_filename_component(COMMON "${CMAKE_SOURCE_DIR}/common" ABSOLUTE)

include(${CMAKE_SOURCE_DIR}/${project}/CMake_project)
message(STATUS "project ${PROJECT_NAME} with ${languages}")
PROJECT(${PROJECT_NAME} ${languages})

# directly make an error if in-source build
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.\n"
"Please create a build directory first and execute cmake configuration from "
"this directory. Example: mkdir build && cd build && cmake ..")
endif()

#########################
### VARIABLES ###########
#########################
option(MOAO_TESTING "Generates testing binaries" OFF)
option(GPU "Enable GPU support" OFF)
option(USE_INTERSAMPLE "Go through the intersample process and generates PSFs" OFF)

# Version
# Number 0.1.1 is temptative, may differ from actual release.
SET( MOAO_VERSION_MAJOR 0 )
SET( MOAO_VERSION_MINOR 1 )
SET( MOAO_VERSION_PATCH 1 )
set( MOAO_VERSION "${MOAO_VERSION_MAJOR}.${MOAO_VERSION_MINOR}.${MOAO_VERSION_PATCH}" )

# Set the RPATH config
# --------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, use the install RPATH already
# (automated test will need this)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# the RPATH to be used when installing
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# Packaging (make package)
SET(CPACK_PACKAGE_VERSION ${MOAO_VERSION})
SET(CPACK_GENERATOR "TGZ")
INCLUDE(CPack)

# Define the common include directory of the project
include_directories( ${CMAKE_SOURCE_DIR}/include )

## CMAKE MODULES :: ECRC
## REQUIRED FOR TESTS TO LINK LIBRARIES
include(${PROJECT_SOURCE_DIR}/cmake_modules/CMake_initEcrc)


list(APPEND link_lib "")
################################
# load fits library (compulsory)
set(CFITSIO_ROOT $ENV{CFITSIO_ROOT} CACHE PATH "Path to the root of cfitsio")
if("${CFITSIO_ROOT}" STREQUAL "")
message( FATAL_ERROR "Environment variable CFITSIO_ROOT is not set. Specify it with -DCFITSIO_ROOT=path/to/cfitsio")
endif()
message( WARNING "Environment variable CFITSIO_ROOT ${CFITSIO_ROOT}")
include_directories(${CFITSIO_ROOT}/include)
link_directories(${CFITSIO_ROOT})
list(INSERT link_lib 0 "cfitsio" )


################################
# load fftw3 library
# no need to set this up if fftw is in /usr/lib
set(FFTW_ROOT $ENV{FFTW_ROOT} CACHE PATH "Path to the root of fftw3")
if("${FFTW_ROOT}" STREQUAL "")
message( FATAL_ERROR "Environment variable FFTW_ROOT is not set. Specify it with -DFFTW_ROOT=path/to/fftw3")
endif()
include_directories(${FFTW_ROOT}/include)
link_directories( ${FFTW_ROOT} )
list(INSERT link_lib 0 "fftw3" )


set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ")
set(extra_flags "")

if(${USE_LAPACK})
include (${CMAKE_SOURCE_DIR}/cmake_modules/CMake_loadLapack)
set(extra_flags "${extra_flags} -DUSE_LAPACK")
if(USE_OPENMP)
find_package(OpenMP)
set(extra_flags "${extra_flags} -DUSE_OPENMP")
endif()
endif()

if(${USE_CHAMELEON})
include (${CMAKE_SOURCE_DIR}/cmake_modules/CMake_loadChameleon)
set(extra_flags "${extra_flags} -DUSE_CHAMELEON")
endif()

if(${USE_INTERSAMPLE})
set(extra_flags "${extra_flags} -DUSE_INTERSAMPLE")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${extra_flags}")

if(${GPU})
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} ${extra_flags} --shared --compiler-options '-fPIC' -gencode arch=compute_30,code=sm_30 --compiler-options -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_GPU ")
endif()



# MOAO code
include(${CMAKE_SOURCE_DIR}/${project}/CMakeLists.txt)

#building library
#if(${GPU})
# CUDA_ADD_LIBRARY(moao_chameleon SHARED ${SRC} )
# set_target_properties(moao_chameleon PROPERTIES LINKER_LANGUAGE C )
#else()
# ADD_LIBRARY(moao_chameleon SHARED ${SRC} )
#endif()
#target_link_libraries(moao_chameleon "${link_lib}" )

#buiding executable
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CHAMELEON -DUSE_MATCOV_TILED -DUSE_INTERSAMPLE -DCHECK_CHAMELEON")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MATCOV_TILED ")
if(${GPU})
CUDA_ADD_EXECUTABLE(${MAIN} ${SRC})
set_target_properties(${MAIN} PROPERTIES LINKER_LANGUAGE C )
else()
ADD_EXECUTABLE(${MAIN} ${SRC})
endif()
target_link_libraries(${MAIN} "${link_lib}")
#add_dependencies()


25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2017, King Abdullah University of Science and Technology,
Observatoire de Paris Meudon
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
131 changes: 131 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
MOAO
========
The MOAO project is an experimental framework for the simulation
of Multi-Object Adaptive Optics systems.
Using a pseudo-analytical approach leveraged by the computational power of
manycore architectures (x86 and GPUs), the MOAO framework calculates
the Tomographic Reconstructor matrix and generates Point Spread Function (PSF)
for arbitrary MOAO systems and atmospheric conditions.


Installation
-------------
First download the sources:
~~~
git clone https://github.com/ecrc/moao MOAO-git
~~~

Then, initialize the submodules:
~~~
cd MOAO-git
git submodule init
git submodule update
~~~

Create a build directory and run CMake:
~~~
mkdir build
cd build
cmake .. -Dproject=chameleon
~~~

The following options can be added:
* -DUSE_INTERSAMPLE=ON to generate PSFs
* -DGPU=ON to enable GPU computation

Finally, compile the project:
~~~
make
~~~


Execution
----------
In order to run the MOAO simulation, some values must be defined:
* the number of core : n_cores
* the number of GPUs (if cuda is enabled): n_gpus
* the tile size : tile
* the number of short exposure performed with a single tomographic reconstructor : maxobs
* the number of tomographic reconstructor used a long exposure : maxrefine
* the path to the system parameters : sys_path
* the path to the atmospheric parameters : atm_path

Run the following command with the actual values:
~~~
./moao --n_cores= --n_gpus= --tile= --maxrefine= --maxobs= --sys_path= --atm_path=
~~~

Inputs
------
The execution of the MOAO framework requires:
* A text file describing the [System parameters](@ref SYS_PARAM)
* A command matrix ( Dx.fits)
* A text file describing the [Atmospheric parameters](@ref ATM_PARAM)

In order to compute the PSFs, some additional input data are required:
* The influence function of the actuators (abs2fi.fits)
* The list of valid subapertures (idx.fits)
* The optical transfer function of the telescope (otftel.fits)

All those files can be generated by a provided [python script](@ref PY_README) relying on cython.

Input samples can be downloaded as follow :
~~~
wget --quiet --no-check-certificate "https://drive.google.com/uc?export=download&id=0Bw6iRA3hQZNCVEtVRjA1Q2xwM00" -O moao_inputs.tar.gz
~~~
These samples contain the corresponding PSF output for a single iteration (maxrefine=1, maxobs=1)

Dependencies
------------
This project has several dependencies listed below.

### Simulation ###

* chameleon (https://project.inria.fr/chameleon/)
* starpu (http://starpu.gforge.inria.fr/)
* cfitsio (https://heasarc.gsfc.nasa.gov/fitsio/)
* fftw3 (http://www.fftw.org/)

And, optionally:
* cuda

### Parameter generation ###
In addition to the dependencies mentioned above,
the parameter generation, detailed in [cython/pipeline/README.md](@ref PY_README) depends on:

* python2

with the packages

* astropy
* cython

Note that installing anaconda2 (https://conda.io/docs/user-guide/install/download.html)
provide all these dependencies.


References
==========
1. H. Ltaief, D. Gratadour, A. Charara, and E. Gendron, Adaptive Optics Simulation for the
World's Biggest Eye on Multicore Architectures with Multiple GPUs, *ACM Platform for
Advanced Scientific Computing*, 2016.
2. E. Gendron, A. Charara, A. Abdelfattah, D. Gratadour, D. Keyes, H. Ltaief, C. Morel, F.
Vidal, A. Sevin, and G. Rousset, A Novel Fast and Accurate Pseudo-Analytical Simulation Approach
for MOAO", *in Adaptive Optics Systems IV, Proceedings of the SPIE 9148*, 2014.
3. A. Charara, H. Ltaief, D. Gratadour, D. Keyes, A. Sevin, A. Abdelfattah, E. Gendron and C.
Morel, and F. Vidal, Pipelining Computational Stages of the Tomographic Reconstructor for
Multi-object Adaptive Optics on a Multi-GPU System, *Proceedings of the ACM International
Conference for High Performance Computing, Networking, Storage and Analysis*, pp. 262-273, 2014.
4. A. Abdelfattah, E. Gendron, D. Gratadour, D. Keyes, H. Ltaief, A. Sevin, and F. Vidal, High
Performance Pseudo-analytical Simulation of Multi-Object Adaptive Optics over Multi-GPU
Systems, *Proceedings of the 20th International Euro-Par Conference*, vol. 8632, pp .704–715, 2014.


Questions?
==========
Please feel free to create an issue on Github for any questions and inquiries.


Handout
========
![Handout](docs/MOAO-handout-final.png)
Loading

0 comments on commit ffa729f

Please sign in to comment.