2016-09-07 07:06:32 +08:00
IF ( COMMAND TRIBITS_PACKAGE_DECL )
SET ( KOKKOS_HAS_TRILINOS ON CACHE BOOL "" )
ELSE ( )
SET ( KOKKOS_HAS_TRILINOS OFF CACHE BOOL "" )
ENDIF ( )
IF ( NOT KOKKOS_HAS_TRILINOS )
2017-06-09 00:42:08 +08:00
cmake_minimum_required ( VERSION 3.1 FATAL_ERROR )
project ( Kokkos CXX )
2016-09-07 07:06:32 +08:00
2017-06-09 00:42:08 +08:00
INCLUDE ( cmake/kokkos.cmake )
ELSE ( )
#------------------------------------------------------------------------------
2016-09-07 07:06:32 +08:00
#
# A) Forward delcare the package so that certain options are also defined for
# subpackages
#
TRIBITS_PACKAGE_DECL ( Kokkos ) # ENABLE_SHADOWING_WARNINGS)
2017-06-09 00:42:08 +08:00
2016-09-07 07:06:32 +08:00
#------------------------------------------------------------------------------
#
# B) Define the common options for Kokkos first so they can be used by
# subpackages as well.
#
# mfh 01 Aug 2016: See Issue #61:
#
# https://github.com/kokkos/kokkos/issues/61
#
# Don't use TRIBITS_ADD_DEBUG_OPTION() here, because that defines
# HAVE_KOKKOS_DEBUG. We define KOKKOS_HAVE_DEBUG here instead,
# for compatibility with Kokkos' Makefile build system.
TRIBITS_ADD_OPTION_AND_DEFINE (
2017-01-10 01:39:46 +08:00
K o k k o s _ E N A B L E _ D E B U G
K O K K O S _ H A V E _ D E B U G
2016-09-07 07:06:32 +08:00
" E n a b l e r u n - t i m e d e b u g c h e c k s . T h e s e c h e c k s m a y b e e x p e n s i v e , s o t h e y a r e d i s a b l e d b y d e f a u l t i n a r e l e a s e b u i l d . "
$ { $ { P R O J E C T _ N A M E } _ E N A B L E _ D E B U G }
)
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ S I E R R A _ B U I L D
K O K K O S _ F O R _ S I E R R A
" C o n f i g u r e K o k k o s f o r b u i l d i n g w i t h i n t h e S i e r r a b u i l d s y s t e m . "
O F F
)
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ C u d a
K O K K O S _ H A V E _ C U D A
" E n a b l e C U D A s u p p o r t i n K o k k o s . "
" $ { T P L _ E N A B L E _ C U D A } "
)
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ C u d a _ U V M
K O K K O S _ U S E _ C U D A _ U V M
2017-01-10 01:39:46 +08:00
" E n a b l e C U D A U n i f i e d V i r t u a l M e m o r y a s t h e d e f a u l t i n K o k k o s . "
O F F
)
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ C u d a _ R D C
K O K K O S _ H A V E _ C U D A _ R D C
" E n a b l e C U D A R e l o c a t a b l e D e v i c e C o d e s u p p o r t i n K o k k o s . "
O F F
)
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ C u d a _ L a m b d a
K O K K O S _ H A V E _ C U D A _ L A M B D A
" E n a b l e C U D A L A M B D A s u p p o r t i n K o k k o s . "
2016-09-07 07:06:32 +08:00
O F F
)
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ P t h r e a d
K O K K O S _ H A V E _ P T H R E A D
" E n a b l e P t h r e a d s u p p o r t i n K o k k o s . "
O F F
)
ASSERT_DEFINED ( TPL_ENABLE_Pthread )
2017-06-09 00:42:08 +08:00
IF ( Kokkos_ENABLE_Pthread AND NOT TPL_ENABLE_Pthread )
2016-09-07 07:06:32 +08:00
MESSAGE ( FATAL_ERROR "You set Kokkos_ENABLE_Pthread=ON, but Trilinos' support for Pthread(s) is not enabled (TPL_ENABLE_Pthread=OFF). This is not allowed. Please enable Pthreads in Trilinos before attempting to enable Kokkos' support for Pthreads." )
2017-06-09 00:42:08 +08:00
ENDIF ( )
IF ( NOT TPL_ENABLE_Pthread )
2017-01-10 01:39:46 +08:00
ADD_DEFINITIONS ( -DGTEST_HAS_PTHREAD=0 )
ENDIF ( )
2016-09-07 07:06:32 +08:00
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ O p e n M P
K O K K O S _ H A V E _ O P E N M P
" E n a b l e O p e n M P s u p p o r t i n K o k k o s . "
" $ { $ { P R O J E C T _ N A M E } _ E N A B L E _ O p e n M P } "
)
TRIBITS_ADD_OPTION_AND_DEFINE (
2017-06-09 00:42:08 +08:00
K o k k o s _ E N A B L E _ Q T H R E A D
2017-04-26 03:48:51 +08:00
K O K K O S _ H A V E _ Q T H R E A D S
" E n a b l e Q t h r e a d s s u p p o r t i n K o k k o s . "
2017-06-09 00:42:08 +08:00
" $ { T P L _ E N A B L E _ Q T H R E A D } "
2016-09-07 07:06:32 +08:00
)
2017-06-09 00:42:08 +08:00
# TODO: No longer an option in Kokkos. Needs to be removed.
2016-09-07 07:06:32 +08:00
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ C X X 1 1
K O K K O S _ H A V E _ C X X 1 1
" E n a b l e C + + 1 1 s u p p o r t i n K o k k o s . "
" $ { $ { P R O J E C T _ N A M E } _ E N A B L E _ C X X 1 1 } "
)
2017-04-26 03:48:51 +08:00
2016-09-07 07:06:32 +08:00
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ H W L O C
K O K K O S _ H A V E _ H W L O C
" E n a b l e H W L O C s u p p o r t i n K o k k o s . "
" $ { T P L _ E N A B L E _ H W L O C } "
)
2017-06-09 00:42:08 +08:00
# TODO: This is currently not used in Kokkos. Should it be removed?
2016-09-07 07:06:32 +08:00
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ M P I
K O K K O S _ H A V E _ M P I
" E n a b l e M P I s u p p o r t i n K o k k o s . "
" $ { T P L _ E N A B L E _ M P I } "
)
# Set default value of Kokkos_ENABLE_Debug_Bounds_Check option
#
# CMake is case sensitive. The Kokkos_ENABLE_Debug_Bounds_Check
# option (defined below) is annoyingly not all caps, but we need to
# keep it that way for backwards compatibility. If users forget and
# try using an all-caps variable, then make it count by using the
# all-caps version as the default value of the original, not-all-caps
# option. Otherwise, the default value of this option comes from
# Kokkos_ENABLE_DEBUG (see Issue #367).
ASSERT_DEFINED ( ${ PACKAGE_NAME } _ENABLE_DEBUG )
IF ( DEFINED Kokkos_ENABLE_DEBUG_BOUNDS_CHECK )
IF ( Kokkos_ENABLE_DEBUG_BOUNDS_CHECK )
SET ( Kokkos_ENABLE_Debug_Bounds_Check_DEFAULT ON )
ELSE ( )
SET ( Kokkos_ENABLE_Debug_Bounds_Check_DEFAULT "${${PACKAGE_NAME}_ENABLE_DEBUG}" )
ENDIF ( )
ELSE ( )
SET ( Kokkos_ENABLE_Debug_Bounds_Check_DEFAULT "${${PACKAGE_NAME}_ENABLE_DEBUG}" )
ENDIF ( )
ASSERT_DEFINED ( Kokkos_ENABLE_Debug_Bounds_Check_DEFAULT )
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ D e b u g _ B o u n d s _ C h e c k
K O K K O S _ E N A B L E _ D E B U G _ B O U N D S _ C H E C K
" E n a b l e K o k k o s : : V i e w r u n - t i m e b o u n d s c h e c k i n g . "
" $ { K o k k o s _ E N A B L E _ D e b u g _ B o u n d s _ C h e c k _ D E F A U L T } "
)
2017-06-09 00:42:08 +08:00
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ D e b u g _ D u a l V i e w _ M o d i f y _ C h e c k
K O K K O S _ E N A B L E _ D E B U G _ D U A L V I E W _ M O D I F Y _ C H E C K
" E n a b l e a b o r t w h e n K o k k o s : : D u a l V i e w m o d i f i e d o n h o s t a n d d e v i c e w i t h o u t s y n c . "
" $ { K o k k o s _ E N A B L E _ D E B U G } "
)
2016-09-07 07:06:32 +08:00
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ P r o f i l i n g
2017-06-09 00:42:08 +08:00
K O K K O S _ E N A B L E _ P R O F I L I N G
2016-09-07 07:06:32 +08:00
" E n a b l e K o k k o s P p r o f i l i n g s u p p o r t f o r k e r n e l d a t a c o l l e c t i o n s . "
" $ { T P L _ E N A B L E _ D L l i b } "
)
2017-06-09 00:42:08 +08:00
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ P r o f i l i n g _ L o a d _ P r i n t
K O K K O S _ E N A B L E _ P R O F I L I N G _ L O A D _ P R I N T
" P r i n t t o s t a n d a r d o u t p u t w h i c h p r o f i l i n g l i b r a r y w a s l o a d e d . "
O F F
)
2016-09-07 07:06:32 +08:00
# placeholder for future device...
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ E N A B L E _ W i n t h r e a d
K O K K O S _ H A V E _ W I N T H R E A D
" E n a b l e W i n t h r e a d s u p p o r t i n K o k k o s . "
" $ { T P L _ E N A B L E _ W i n t h r e a d } "
)
2017-06-09 00:42:08 +08:00
# TODO: No longer an option in Kokkos. Needs to be removed.
2016-09-07 07:06:32 +08:00
# use new/old View
TRIBITS_ADD_OPTION_AND_DEFINE (
K o k k o s _ U S I N G _ D E P R E C A T E D _ V I E W
K O K K O S _ U S I N G _ D E P R E C A T E D _ V I E W
" C h o o s e w h e t h e r t o u s e t h e o l d , d e p r e c a t e d K o k k o s : : V i e w "
O F F
)
2017-06-09 00:42:08 +08:00
2016-09-07 07:06:32 +08:00
#------------------------------------------------------------------------------
#
2017-01-10 01:39:46 +08:00
# C) Install Kokkos' executable scripts
#
# nvcc_wrapper is Kokkos' wrapper for NVIDIA's NVCC CUDA compiler.
# Kokkos needs nvcc_wrapper in order to build. Other libraries and
# executables also need nvcc_wrapper. Thus, we need to install it.
# If the argument of DESTINATION is a relative path, CMake computes it
# as relative to ${CMAKE_INSTALL_PATH}.
INSTALL ( PROGRAMS ${ CMAKE_CURRENT_SOURCE_DIR } /bin/nvcc_wrapper DESTINATION bin )
#------------------------------------------------------------------------------
#
# D) Process the subpackages for Kokkos
2016-09-07 07:06:32 +08:00
#
TRIBITS_PROCESS_SUBPACKAGES ( )
2017-06-09 00:42:08 +08:00
#------------------------------------------------------------------------------
2016-09-07 07:06:32 +08:00
#
2017-01-10 01:39:46 +08:00
# E) If Kokkos itself is enabled, process the Kokkos package
2016-09-07 07:06:32 +08:00
#
TRIBITS_PACKAGE_DEF ( )
TRIBITS_EXCLUDE_AUTOTOOLS_FILES ( )
TRIBITS_EXCLUDE_FILES (
c l a s s i c / d o c
c l a s s i c / L i n A l g / d o c / C r s R e f a c t o r N o t e s M a y 2 0 1 2
)
TRIBITS_PACKAGE_POSTPROCESS ( )
2017-06-09 00:42:08 +08:00
ENDIF ( )