Skip to content

Commit

Permalink
update handout
Browse files Browse the repository at this point in the history
  • Loading branch information
nournadar committed Nov 29, 2020
1 parent ffa729f commit 21b671c
Show file tree
Hide file tree
Showing 965 changed files with 133,820 additions and 3,565 deletions.
159 changes: 81 additions & 78 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
cmake_minimum_required(VERSION 3.2.3)
cmake_minimum_required(VERSION 3.5.1)


#set common absolute path
get_filename_component(COMMON "${CMAKE_SOURCE_DIR}/common" ABSOLUTE)
#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})
#message(STATUS "project ${PROJECT_NAME} with ${languages}")
PROJECT(moao C CXX)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

# directly make an error if in-source build
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
Expand All @@ -19,9 +20,24 @@
### VARIABLES ###########
#########################
option(MOAO_TESTING "Generates testing binaries" OFF)
option(GPU "Enable GPU support" OFF)
option(USE_GPU "Enable GPU support" OFF)
set(CUDA_GENCODE "60" CACHE STRING "cuda gencode")
option(USE_OPENMP "Enable OpenMP support" OFF)
option(USE_INTERSAMPLE "Go through the intersample process and generates PSFs" OFF)

option(USE_MATCOV_TILED "create covariance matrix using rodconan model (else random)" ON)
option(DEBUG "use debug flags" OFF)

set(GENCODE "")
string(REPLACE " " ";" CUDA_GENCODE "${CUDA_GENCODE}")
foreach(code ${CUDA_GENCODE} )
set(GENCODE ${GENCODE} "-gencode arch=compute_${code},code=sm_${code} ")
endforeach()
message(WARNING ${GENCODE})

if(${DEBUG})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0")
endif()
# Version
# Number 0.1.1 is temptative, may differ from actual release.
SET( MOAO_VERSION_MAJOR 0 )
Expand All @@ -45,90 +61,77 @@
INCLUDE(CPack)

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

## CMAKE MODULES :: ECRC
## REQUIRED FOR TESTS TO LINK LIBRARIES
# 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_OPENMP)#TODO
# find_package(OpenMP)
# add_definitions(-DUSE_OPENMP ${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS})
#endif()

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()
if(USE_INTERSAMPLE)
add_definitions(-DUSE_INTERSAMPLE)
endif()

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

if(${USE_INTERSAMPLE})
set(extra_flags "${extra_flags} -DUSE_INTERSAMPLE")
if(${project} STREQUAL "chameleon")
add_definitions(-DUSE_CHAMELEON)
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 ")
if(LAPACKE_LIBRARIES MATCHES "mkl")
add_definitions( -DUSE_MKL)
endif()
if(USE_GPU)
add_definitions(-DUSE_GPU)
endif()

add_subdirectory(common)
if(NOT ${project} STREQUAL "common")
add_subdirectory(${project})
set(SRC ${project}/moao_${project}.cpp)


link_directories(${LINK_DIRS})
if(USE_GPU)
CUDA_ADD_EXECUTABLE(${PROJECT_NAME} ${SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C )
ADD_EXECUTABLE(check_${PROJECT_NAME} ${project}/check_moao_${project}.cpp)
set_target_properties(check_${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C )
else()
ADD_EXECUTABLE(${PROJECT_NAME} ${SRC})
ADD_EXECUTABLE(check_${PROJECT_NAME} ${project}/check_moao_${project}.cpp)
endif()
target_include_directories(check_${PROJECT_NAME} PRIVATE ${project} common)
target_include_directories( ${PROJECT_NAME} PRIVATE ${project} common)
target_link_libraries(check_${PROJECT_NAME} common moao_${project})
target_link_libraries( ${PROJECT_NAME} common moao_${project})


# 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()


## Installing
# add installation for target common
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}_export
RUNTIME DESTINATION ${PREFIX}/bin
ARCHIVE DESTINATION ${PREFIX}/lib
LIBRARY DESTINATION ${PREFIX}/lib
INCLUDES DESTINATION ${PREFIX}/include
)
# copy public include files
message(WARNING "destination:include/${PROJECT_NAME}")
install(FILES
include/${PROJECT_NAME}/config.h
include/${PROJECT_NAME}/make_${PROJECT_NAME}.h
DESTINATION include/${PROJECT_NAME})


# create export file which can be imported by other cmake projects
#install(EXPORT ${PROJECT_NAME}_export
# NAMESPACE MOAO::
# DESTINATION lib/cmake/${PROJECT_NAME}
#)
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ 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 core : ncores
* the number of GPUs (if cuda is enabled): ngpus
* the tile size : ts
* 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=
./moao --ncores= --ngpus= --ts= --maxrefine= --maxobs= --sys_path= --atm_path=
~~~

Inputs
Expand Down Expand Up @@ -81,10 +81,10 @@ 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/)
* chameleon (https://project.inria.fr/chameleon/ last version tested: gitlab commit 8595b23c )
* starpu (http://starpu.gforge.inria.fr/ last version tested: 1.2.3)
* cfitsio (https://heasarc.gsfc.nasa.gov/fitsio/ last version tested: 3.420)
* fftw3 (http://www.fftw.org/ last version tested: 3.3.7)

And, optionally:
* cuda
Expand All @@ -106,17 +106,20 @@ provide all these dependencies.

References
==========
1. H. Ltaief, D. Gratadour, A. Charara, and E. Gendron, Adaptive Optics Simulation for the
1. N. Doucet, H. Ltaief, D. Gratadour and D. Keyes, Mixed-Precision Tomographic Reconstructor
Computations on Hardware Accelerators, *2019 IEEE/ACM 9th Workshop on Irregular Applications:
Architectures and Algorithms (IA3)*, Denver, CO, USA, pp. 31-38, doi: 10.1109/IA349570.2019.00011, 2019.
2. 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.
3. 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.
4. 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
5. 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.

Expand All @@ -128,4 +131,4 @@ Please feel free to create an issue on Github for any questions and inquiries.

Handout
========
![Handout](docs/MOAO-handout-final.png)
![Handout](docs/astronomy-handout-final.png)
93 changes: 55 additions & 38 deletions chameleon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,60 @@
cmake_minimum_required(VERSION 3.5.1)

set(CHAMELEON ${CMAKE_SOURCE_DIR}/chameleon)
PROJECT(moao_chameleon C CXX)

set(MAIN moao)
# 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()

if(LAPACKE_LIBRARIES MATCHES "mkl")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MKL")
endif()
include (${CMAKE_SOURCE_DIR}/cmake_modules/CMake_loadChameleon)

#TODO: include from common
set(SRC_COMMON ${COMMON}/arguments.c
${COMMON}/fits.c
${COMMON}/tomo_struct.c
${COMMON}/noise.c
${COMMON}/utils.c
if(STARPU_FOUND)
include(runtime/starpu/CMakeLists.txt)
set(RUNTIME_INC runtime/starpu/codelet)
endif()

include(compute/CMakeLists.txt)
set(SRC ${COMPUTE_SRC}
${CODELET_SRC}
)
include_directories(${COMMON})

set(SRC ${CHAMELEON}/moao_chameleon.c
${COMMON}/reconstructor.c
${COMMON}/codelet_dscaldiag.c
${COMMON}/codelet_matcov.c
${COMMON}/dscaldiag.c
${COMMON}/matcov_kernels.c
${COMMON}/matcov.c
${COMMON}/cee_cvv.c
)

if(${GPU})
set(SRC ${SRC}
${COMMON}/matcov_kernels_gpu.cu
)
endif()

include_directories(${CHAMELEON})

set(SRC_INTERSAMPLE ${COMMON}/intersample.c
)

set(SRC ${SRC} ${SRC_COMMON})
if(USE_INTERSAMPLE)
set(SRC ${SRC} ${SRC_INTERSAMPLE})
endif()

link_directories(${CHAMELEON_LIBRARY_DIRS})
set(LINK_DIRS "${CHAMELEON_LIBRARY_DIRS}" ) #PARENT_SCOPE)
message(STATUS "LINK DIR: ${CHAMELEON_LIBRARY_DIRS}")
set(LINK_DIRS ${LINK_DIRS} PARENT_SCOPE)
message(STATUS "LINK DIR2: ${LINK_DIRS}")
if(USE_GPU)
find_package(CUDA REQUIRED)
add_definitions(-DUSE_GPU)
CUDA_ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C )
target_link_libraries(${PROJECT_NAME} ${CHAMELEON_LIBRARIES_DEP} common)
else()
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRC})
target_link_libraries(${PROJECT_NAME} PUBLIC ${CHAMELEON_LIBRARIES_DEP} common)
endif()
target_include_directories(${PROJECT_NAME} PUBLIC compute ./ ${RUNTIME_INC} ${CHAMELEON_INCLUDE_DIRS_DEP} )

## Installing
# add installation for target lapack
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}_export
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
INCLUDES DESTINATION include
)
# copy public include files
install(FILES
include/${PROJECT_NAME}/config.h
include/${PROJECT_NAME}/make_${PROJECT_NAME}.h
DESTINATION include/${PROJECT_NAME})


## create export file which can be imported by other cmake projects
#install(EXPORT ${PROJECT_NAME}_export
# NAMESPACE MOAO::
# DESTINATION lib/cmake/${PROJECT_NAME}
#)
Loading

0 comments on commit 21b671c

Please sign in to comment.