diff --git a/ParadisEO-GPU/.project b/ParadisEO-GPU/.project
new file mode 100644
index 000000000..78e842e87
--- /dev/null
+++ b/ParadisEO-GPU/.project
@@ -0,0 +1,11 @@
+
+
+ ParadisEO-GPU
+
+
+
+
+
+
+
+
diff --git a/ParadisEO-GPU/AUTHORS b/ParadisEO-GPU/AUTHORS
new file mode 100644
index 000000000..a1f03b80a
--- /dev/null
+++ b/ParadisEO-GPU/AUTHORS
@@ -0,0 +1,5 @@
+Authors:
+ Boufaras Karima
+ Thé Van Luong
+
+
diff --git a/ParadisEO-GPU/CMake/cuda/FindCUDA.cmake b/ParadisEO-GPU/CMake/cuda/FindCUDA.cmake
new file mode 100644
index 000000000..6539057ba
--- /dev/null
+++ b/ParadisEO-GPU/CMake/cuda/FindCUDA.cmake
@@ -0,0 +1,1263 @@
+# - Tools for building CUDA C files: libraries and build dependencies.
+# This script locates the NVIDIA CUDA C tools. It should work on linux, windows,
+# and mac and should be reasonably up to date with CUDA C releases.
+#
+# This script makes use of the standard find_package arguments of ,
+# REQUIRED and QUIET. CUDA_FOUND will report if an acceptable version of CUDA
+# was found.
+#
+# The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if the prefix
+# cannot be determined by the location of nvcc in the system path and REQUIRED
+# is specified to find_package(). To use a different installed version of the
+# toolkit set the environment variable CUDA_BIN_PATH before running cmake
+# (e.g. CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default /usr/local/cuda)
+# or set CUDA_TOOLKIT_ROOT_DIR after configuring. If you change the value of
+# CUDA_TOOLKIT_ROOT_DIR, various components that depend on the path will be
+# relocated.
+#
+# It might be necessary to set CUDA_TOOLKIT_ROOT_DIR manually on certain
+# platforms, or to use a cuda runtime not installed in the default location. In
+# newer versions of the toolkit the cuda library is included with the graphics
+# driver- be sure that the driver version matches what is needed by the cuda
+# runtime version.
+#
+# The following variables affect the behavior of the macros in the script (in
+# alphebetical order). Note that any of these flags can be changed multiple
+# times in the same directory before calling CUDA_ADD_EXECUTABLE,
+# CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX or CUDA_WRAP_SRCS.
+#
+# CUDA_64_BIT_DEVICE_CODE (Default matches host bit size)
+# -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code.
+# Note that making this different from the host code when generating object
+# or C files from CUDA code just won't work, because size_t gets defined by
+# nvcc in the generated source. If you compile to PTX and then load the
+# file yourself, you can mix bit sizes between device and host.
+#
+# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON)
+# -- Set to ON if you want the custom build rule to be attached to the source
+# file in Visual Studio. Turn OFF if you add the same cuda file to multiple
+# targets.
+#
+# This allows the user to build the target from the CUDA file; however, bad
+# things can happen if the CUDA source file is added to multiple targets.
+# When performing parallel builds it is possible for the custom build
+# command to be run more than once and in parallel causing cryptic build
+# errors. VS runs the rules for every source file in the target, and a
+# source can have only one rule no matter how many projects it is added to.
+# When the rule is run from multiple targets race conditions can occur on
+# the generated file. Eventually everything will get built, but if the user
+# is unaware of this behavior, there may be confusion. It would be nice if
+# this script could detect the reuse of source files across multiple targets
+# and turn the option off for the user, but no good solution could be found.
+#
+# CUDA_BUILD_CUBIN (Default OFF)
+# -- Set to ON to enable and extra compilation pass with the -cubin option in
+# Device mode. The output is parsed and register, shared memory usage is
+# printed during build.
+#
+# CUDA_BUILD_EMULATION (Default OFF for device mode)
+# -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files
+# when CUDA_BUILD_EMULATION is TRUE.
+#
+# CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)
+# -- Set to the path you wish to have the generated files placed. If it is
+# blank output files will be placed in CMAKE_CURRENT_BINARY_DIR.
+# Intermediate files will always be placed in
+# CMAKE_CURRENT_BINARY_DIR/CMakeFiles.
+#
+# CUDA_HOST_COMPILATION_CPP (Default ON)
+# -- Set to OFF for C compilation of host code.
+#
+# CUDA_NVCC_FLAGS
+# CUDA_NVCC_FLAGS_
+# -- Additional NVCC command line arguments. NOTE: multiple arguments must be
+# semi-colon delimited (e.g. --compiler-options;-Wall)
+#
+# CUDA_PROPAGATE_HOST_FLAGS (Default ON)
+# -- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration
+# dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the
+# host compiler through nvcc's -Xcompiler flag. This helps make the
+# generated host code match the rest of the system better. Sometimes
+# certain flags give nvcc problems, and this will help you turn the flag
+# propagation off. This does not affect the flags supplied directly to nvcc
+# via CUDA_NVCC_FLAGS or through the OPTION flags specified through
+# CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for
+# shared library compilation are not affected by this flag.
+#
+# CUDA_VERBOSE_BUILD (Default OFF)
+# -- Set to ON to see all the commands used when building the CUDA file. When
+# using a Makefile generator the value defaults to VERBOSE (run make
+# VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will
+# always print the output.
+#
+# The script creates the following macros (in alphebetical order):
+#
+# CUDA_ADD_CUFFT_TO_TARGET( cuda_target )
+# -- Adds the cufft library to the target (can be any target). Handles whether
+# you are in emulation mode or not.
+#
+# CUDA_ADD_CUBLAS_TO_TARGET( cuda_target )
+# -- Adds the cublas library to the target (can be any target). Handles
+# whether you are in emulation mode or not.
+#
+# CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ...
+# [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
+# -- Creates an executable "cuda_target" which is made up of the files
+# specified. All of the non CUDA C files are compiled using the standard
+# build rules specified by CMAKE and the cuda files are compiled to object
+# files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is
+# added automatically to include_directories(). Some standard CMake target
+# calls can be used on the target after calling this macro
+# (e.g. set_target_properties and target_link_libraries), but setting
+# properties that adjust compilation flags will not affect code compiled by
+# nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE,
+# CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS.
+#
+# CUDA_ADD_LIBRARY( cuda_target file0 file1 ...
+# [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
+# -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
+#
+# CUDA_BUILD_CLEAN_TARGET()
+# -- Creates a convience target that deletes all the dependency files
+# generated. You should make clean after running this target to ensure the
+# dependency files get regenerated.
+#
+# CUDA_COMPILE( generated_files file0 file1 ... [STATIC | SHARED | MODULE]
+# [OPTIONS ...] )
+# -- Returns a list of generated files from the input source files to be used
+# with ADD_LIBRARY or ADD_EXECUTABLE.
+#
+# CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
+# -- Returns a list of PTX files generated from the input source files.
+#
+# CUDA_INCLUDE_DIRECTORIES( path0 path1 ... )
+# -- Sets the directories that should be passed to nvcc
+# (e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu
+# files.
+#
+# CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
+# [STATIC | SHARED | MODULE] [OPTIONS ...] )
+# -- This is where all the magic happens. CUDA_ADD_EXECUTABLE,
+# CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this
+# function under the hood.
+#
+# Given the list of files (file0 file1 ... fileN) this macro generates
+# custom commands that generate either PTX or linkable objects (use "PTX" or
+# "OBJ" for the format argument to switch). Files that don't end with .cu
+# or have the HEADER_FILE_ONLY property are ignored.
+#
+# The arguments passed in after OPTIONS are extra command line options to
+# give to nvcc. You can also specify per configuration options by
+# specifying the name of the configuration followed by the options. General
+# options must preceed configuration specific options. Not all
+# configurations need to be specified, only the ones provided will be used.
+#
+# OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag"
+# DEBUG -g
+# RELEASE --use_fast_math
+# RELWITHDEBINFO --use_fast_math;-g
+# MINSIZEREL --use_fast_math
+#
+# For certain configurations (namely VS generating object files with
+# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will
+# be produced for the given cuda file. This is because when you add the
+# cuda file to Visual Studio it knows that this file produces an object file
+# and will link in the resulting object file automatically.
+#
+# This script will also generate a separate cmake script that is used at
+# build time to invoke nvcc. This is for serveral reasons.
+#
+# 1. nvcc can return negative numbers as return values which confuses
+# Visual Studio into thinking that the command succeeded. The script now
+# checks the error codes and produces errors when there was a problem.
+#
+# 2. nvcc has been known to not delete incomplete results when it
+# encounters problems. This confuses build systems into thinking the
+# target was generated when in fact an unusable file exists. The script
+# now deletes the output files if there was an error.
+#
+# 3. By putting all the options that affect the build into a file and then
+# make the build rule dependent on the file, the output files will be
+# regenerated when the options change.
+#
+# This script also looks at optional arguments STATIC, SHARED, or MODULE to
+# determine when to target the object compilation for a shared library.
+# BUILD_SHARED_LIBS is ignored in CUDA_WRAP_SRCS, but it is respected in
+# CUDA_ADD_LIBRARY. On some systems special flags are added for building
+# objects intended for shared libraries. A preprocessor macro,
+# _EXPORTS is defined when a shared library compilation is
+# detected.
+#
+# Flags passed into add_definitions with -D or /D are passed along to nvcc.
+#
+# The script defines the following variables:
+#
+# CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc.
+# CUDA_VERSION_MINOR -- The minor version.
+# CUDA_VERSION
+# CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
+#
+# CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set).
+# CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the
+# SDK. This script will not directly support finding
+# specific libraries or headers, as that isn't
+# supported by NVIDIA. If you want to change
+# libraries when the path changes see the
+# FindCUDA.cmake script for an example of how to clear
+# these variables. There are also examples of how to
+# use the CUDA_SDK_ROOT_DIR to locate headers or
+# libraries, if you so choose (at your own risk).
+# CUDA_INCLUDE_DIRS -- Include directory for cuda headers. Added automatically
+# for CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY.
+# CUDA_LIBRARIES -- Cuda RT library.
+# CUDA_CUFFT_LIBRARIES -- Device or emulation library for the Cuda FFT
+# implementation (alternative to:
+# CUDA_ADD_CUFFT_TO_TARGET macro)
+# CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS
+# implementation (alterative to:
+# CUDA_ADD_CUBLAS_TO_TARGET macro).
+#
+#
+# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
+# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
+#
+# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
+#
+# Copyright (c) 2007-2009
+# Scientific Computing and Imaging Institute, University of Utah
+#
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+###############################################################################
+
+# FindCUDA.cmake
+
+# We need to have at least this version to support the VERSION_LESS argument to 'if' (2.6.2) and unset (2.6.3)
+cmake_policy(PUSH)
+cmake_minimum_required(VERSION 2.6.3)
+cmake_policy(POP)
+
+# This macro helps us find the location of helper files we will need the full path to
+macro(CUDA_FIND_HELPER_FILE _name _extension)
+ set(_full_name "${_name}.${_extension}")
+ # CMAKE_CURRENT_LIST_FILE contains the full path to the file currently being
+ # processed. Using this variable, we can pull out the current path, and
+ # provide a way to get access to the other files we need local to here.
+ get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+ find_file(CUDA_${_name} ${_full_name} PATHS ${CMAKE_CURRENT_LIST_DIR}/FindCUDA NO_DEFAULT_PATH)
+ if(NOT CUDA_${_name})
+ set(error_message "${_full_name} not found in CMAKE_MODULE_PATH")
+ if(CUDA_FIND_REQUIRED)
+ message(FATAL_ERROR "${error_message}")
+ else(CUDA_FIND_REQUIRED)
+ if(NOT CUDA_FIND_QUIETLY)
+ message(STATUS "${error_message}")
+ endif(NOT CUDA_FIND_QUIETLY)
+ endif(CUDA_FIND_REQUIRED)
+ endif(NOT CUDA_${_name})
+ # Set this variable as internal, so the user isn't bugged with it.
+ set(CUDA_${_name} ${CUDA_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE)
+endmacro(CUDA_FIND_HELPER_FILE)
+
+#####################################################################
+## CUDA_INCLUDE_NVCC_DEPENDENCIES
+##
+
+# So we want to try and include the dependency file if it exists. If
+# it doesn't exist then we need to create an empty one, so we can
+# include it.
+
+# If it does exist, then we need to check to see if all the files it
+# depends on exist. If they don't then we should clear the dependency
+# file and regenerate it later. This covers the case where a header
+# file has disappeared or moved.
+
+macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file)
+ set(CUDA_NVCC_DEPEND)
+ set(CUDA_NVCC_DEPEND_REGENERATE FALSE)
+
+
+ # Include the dependency file. Create it first if it doesn't exist . The
+ # INCLUDE puts a dependency that will force CMake to rerun and bring in the
+ # new info when it changes. DO NOT REMOVE THIS (as I did and spent a few
+ # hours figuring out why it didn't work.
+ if(NOT EXISTS ${dependency_file})
+ file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n")
+ endif()
+ # Always include this file to force CMake to run again next
+ # invocation and rebuild the dependencies.
+ #message("including dependency_file = ${dependency_file}")
+ include(${dependency_file})
+
+ # Now we need to verify the existence of all the included files
+ # here. If they aren't there we need to just blank this variable and
+ # make the file regenerate again.
+# if(DEFINED CUDA_NVCC_DEPEND)
+# message("CUDA_NVCC_DEPEND set")
+# else()
+# message("CUDA_NVCC_DEPEND NOT set")
+# endif()
+ if(CUDA_NVCC_DEPEND)
+ #message("CUDA_NVCC_DEPEND true")
+ foreach(f ${CUDA_NVCC_DEPEND})
+ #message("searching for ${f}")
+ if(NOT EXISTS ${f})
+ #message("file ${f} not found")
+ set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
+ endif()
+ endforeach(f)
+ else(CUDA_NVCC_DEPEND)
+ #message("CUDA_NVCC_DEPEND false")
+ # No dependencies, so regenerate the file.
+ set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
+ endif(CUDA_NVCC_DEPEND)
+
+ #message("CUDA_NVCC_DEPEND_REGENERATE = ${CUDA_NVCC_DEPEND_REGENERATE}")
+ # No incoming dependencies, so we need to generate them. Make the
+ # output depend on the dependency file itself, which should cause the
+ # rule to re-run.
+ if(CUDA_NVCC_DEPEND_REGENERATE)
+ file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n")
+ endif(CUDA_NVCC_DEPEND_REGENERATE)
+
+endmacro(CUDA_INCLUDE_NVCC_DEPENDENCIES)
+
+###############################################################################
+###############################################################################
+# Setup variables' defaults
+###############################################################################
+###############################################################################
+
+# Allow the user to specify if the device code is supposed to be 32 or 64 bit.
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(CUDA_64_BIT_DEVICE_CODE_DEFAULT ON)
+else()
+ set(CUDA_64_BIT_DEVICE_CODE_DEFAULT OFF)
+endif()
+option(CUDA_64_BIT_DEVICE_CODE "Compile device code in 64 bit mode" ${CUDA_64_BIT_DEVICE_CODE_DEFAULT})
+
+# Attach the build rule to the source file in VS. This option
+option(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE "Attach the build rule to the CUDA source file. Enable only when the CUDA source file is added to at most one target." ON)
+
+# Prints out extra information about the cuda file during compilation
+option(CUDA_BUILD_CUBIN "Generate and parse .cubin files in Device mode." OFF)
+
+# Set whether we are using emulation or device mode.
+option(CUDA_BUILD_EMULATION "Build in Emulation mode" OFF)
+
+# Where to put the generated output.
+set(CUDA_GENERATED_OUTPUT_DIR "" CACHE PATH "Directory to put all the output files. If blank it will default to the CMAKE_CURRENT_BINARY_DIR")
+
+# Parse HOST_COMPILATION mode.
+option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
+
+# Extra user settable flags
+set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
+
+# Propagate the host flags to the host compiler via -Xcompiler
+option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
+
+# Specifies whether the commands used when compiling the .cu file will be printed out.
+option(CUDA_VERBOSE_BUILD "Print out the commands run while compiling the CUDA source file. With the Makefile generator this defaults to VERBOSE variable specified on the command line, but can be forced on with this option." OFF)
+
+mark_as_advanced(
+ CUDA_64_BIT_DEVICE_CODE
+ CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE
+ CUDA_GENERATED_OUTPUT_DIR
+ CUDA_HOST_COMPILATION_CPP
+ CUDA_NVCC_FLAGS
+ CUDA_PROPAGATE_HOST_FLAGS
+ )
+
+# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we
+# need to add another entry for the CMAKE_BUILD_TYPE. We also need to add the
+# standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo)
+# for completeness. We need run this loop in order to accomodate the addition
+# of extra configuration types. Duplicate entries will be removed by
+# REMOVE_DUPLICATES.
+set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
+list(REMOVE_DUPLICATES CUDA_configuration_types)
+foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ set(CUDA_NVCC_FLAGS_${config_upper} "" CACHE STRING "Semi-colon delimit multiple arguments.")
+ mark_as_advanced(CUDA_NVCC_FLAGS_${config_upper})
+endforeach()
+
+###############################################################################
+###############################################################################
+# Locate CUDA, Set Build Type, etc.
+###############################################################################
+###############################################################################
+
+# Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed,
+# if they have then clear the cache variables, so that will be detected again.
+if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}")
+ unset(CUDA_NVCC_EXECUTABLE CACHE)
+ unset(CUDA_VERSION CACHE)
+ unset(CUDA_TOOLKIT_INCLUDE CACHE)
+ unset(CUDA_CUDART_LIBRARY CACHE)
+ unset(CUDA_CUDA_LIBRARY CACHE)
+ unset(CUDA_cublas_LIBRARY CACHE)
+ unset(CUDA_cublasemu_LIBRARY CACHE)
+ unset(CUDA_cufft_LIBRARY CACHE)
+ unset(CUDA_cufftemu_LIBRARY CACHE)
+endif()
+
+if(NOT "${CUDA_SDK_ROOT_DIR}" STREQUAL "${CUDA_SDK_ROOT_DIR_INTERNAL}")
+ # No specific variables to catch. Use this kind of code before calling
+ # find_package(CUDA) to clean up any variables that may depend on this path.
+
+ # unset(MY_SPECIAL_CUDA_SDK_INCLUDE_DIR CACHE)
+ # unset(MY_SPECIAL_CUDA_SDK_LIBRARY CACHE)
+endif()
+
+# Search for the cuda distribution.
+if(NOT CUDA_TOOLKIT_ROOT_DIR)
+
+ # Search in the CUDA_BIN_PATH first.
+ find_path(CUDA_TOOLKIT_ROOT_DIR
+ NAMES nvcc nvcc.exe
+ PATHS ENV CUDA_BIN_PATH
+ DOC "Toolkit location."
+ NO_DEFAULT_PATH
+ )
+ # Now search default paths
+ find_path(CUDA_TOOLKIT_ROOT_DIR
+ NAMES nvcc nvcc.exe
+ PATHS /usr/local/bin
+ /usr/local/cuda/bin
+ DOC "Toolkit location."
+ )
+
+ if (CUDA_TOOLKIT_ROOT_DIR)
+ string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR})
+ # We need to force this back into the cache.
+ set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE)
+ endif(CUDA_TOOLKIT_ROOT_DIR)
+ if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
+ if(CUDA_FIND_REQUIRED)
+ message(FATAL_ERROR "Specify CUDA_TOOLKIT_ROOT_DIR")
+ elseif(NOT CUDA_FIND_QUIETLY)
+ message("CUDA_TOOLKIT_ROOT_DIR not found or specified")
+ endif()
+ endif (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
+endif (NOT CUDA_TOOLKIT_ROOT_DIR)
+
+# CUDA_NVCC_EXECUTABLE
+find_program(CUDA_NVCC_EXECUTABLE
+ NAMES nvcc
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin"
+ "${CUDA_TOOLKIT_ROOT_DIR}/bin64"
+ ENV CUDA_BIN_PATH
+ NO_DEFAULT_PATH
+ )
+# Search default search paths, after we search our own set of paths.
+find_program(CUDA_NVCC_EXECUTABLE nvcc)
+mark_as_advanced(CUDA_NVCC_EXECUTABLE)
+
+if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
+ # Compute the version.
+ execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
+ string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT})
+ string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
+ set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.")
+ mark_as_advanced(CUDA_VERSION)
+endif()
+
+# Always set this convenience variable
+set(CUDA_VERSION_STRING "${CUDA_VERSION}")
+
+# Here we need to determine if the version we found is acceptable. We will
+# assume that is unless CUDA_FIND_VERSION_EXACT or CUDA_FIND_VERSION is
+# specified. The presence of either of these options checks the version
+# string and signals if the version is acceptable or not.
+set(_cuda_version_acceptable TRUE)
+#
+if(CUDA_FIND_VERSION_EXACT AND NOT CUDA_VERSION VERSION_EQUAL CUDA_FIND_VERSION)
+ set(_cuda_version_acceptable FALSE)
+endif()
+#
+if(CUDA_FIND_VERSION AND CUDA_VERSION VERSION_LESS CUDA_FIND_VERSION)
+ set(_cuda_version_acceptable FALSE)
+endif()
+#
+if(NOT _cuda_version_acceptable)
+ set(_cuda_error_message "Requested CUDA version ${CUDA_FIND_VERSION}, but found unacceptable version ${CUDA_VERSION}")
+ if(CUDA_FIND_REQUIRED)
+ message("${_cuda_error_message}")
+ elseif(NOT CUDA_FIND_QUIETLY)
+ message("${_cuda_error_message}")
+ endif()
+endif()
+
+# CUDA_TOOLKIT_INCLUDE
+find_path(CUDA_TOOLKIT_INCLUDE
+ device_functions.h # Header included in toolkit
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}/include"
+ ENV CUDA_INC_PATH
+ NO_DEFAULT_PATH
+ )
+# Search default search paths, after we search our own set of paths.
+find_path(CUDA_TOOLKIT_INCLUDE device_functions.h)
+mark_as_advanced(CUDA_TOOLKIT_INCLUDE)
+
+# Set the user list of include dir to nothing to initialize it.
+set (CUDA_NVCC_INCLUDE_ARGS_USER "")
+set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE})
+
+macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(_cuda_64bit_lib_dir "${CUDA_TOOLKIT_ROOT_DIR}/lib64")
+ endif()
+ find_library(${_var}
+ NAMES ${_names}
+ PATHS ${_cuda_64bit_lib_dir}
+ "${CUDA_TOOLKIT_ROOT_DIR}/lib"
+ ENV CUDA_LIB_PATH
+ DOC ${_doc}
+ NO_DEFAULT_PATH
+ )
+ # Search default search paths, after we search our own set of paths.
+ find_library(${_var} NAMES ${_names} DOC ${_doc})
+endmacro()
+
+# CUDA_LIBRARIES
+find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library")
+set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY})
+if(APPLE)
+ # We need to add the path to cudart to the linker using rpath, since the
+ # library name for the cuda libraries is prepended with @rpath.
+ get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH)
+ if(_cuda_path_to_cudart)
+ list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}")
+ endif()
+endif()
+
+# 1.1 toolkit on linux doesn't appear to have a separate library on
+# some platforms.
+find_library_local_first(CUDA_CUDA_LIBRARY cuda "\"cuda\" library (older versions only).")
+
+# Add cuda library to the link line only if it is found.
+if (CUDA_CUDA_LIBRARY)
+ set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
+endif(CUDA_CUDA_LIBRARY)
+
+mark_as_advanced(
+ CUDA_CUDA_LIBRARY
+ CUDA_CUDART_LIBRARY
+ )
+
+#######################
+# Look for some of the toolkit helper libraries
+macro(FIND_CUDA_HELPER_LIBS _name)
+ find_library_local_first(CUDA_${_name}_LIBRARY ${_name} "\"${_name}\" library")
+ mark_as_advanced(CUDA_${_name}_LIBRARY)
+endmacro(FIND_CUDA_HELPER_LIBS)
+
+# Search for cufft and cublas libraries.
+find_cuda_helper_libs(cufftemu)
+find_cuda_helper_libs(cublasemu)
+find_cuda_helper_libs(cufft)
+find_cuda_helper_libs(cublas)
+
+if (CUDA_BUILD_EMULATION)
+ set(CUDA_CUFFT_LIBRARIES ${CUDA_cufftemu_LIBRARY})
+ set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublasemu_LIBRARY})
+else()
+ set(CUDA_CUFFT_LIBRARIES ${CUDA_cufft_LIBRARY})
+ set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY})
+endif()
+
+########################
+# Look for the SDK stuff
+find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h
+ "$ENV{NVSDKCUDA_ROOT}"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]"
+ "/Developer/GPU\ Computing/C"
+ )
+
+# Keep the CUDA_SDK_ROOT_DIR first in order to be able to override the
+# environment variables.
+set(CUDA_SDK_SEARCH_PATH
+ "${CUDA_SDK_ROOT_DIR}"
+ "${CUDA_TOOLKIT_ROOT_DIR}/local/NVSDK0.2"
+ "${CUDA_TOOLKIT_ROOT_DIR}/NVSDK0.2"
+ "${CUDA_TOOLKIT_ROOT_DIR}/NV_CUDA_SDK"
+ "$ENV{HOME}/NVIDIA_CUDA_SDK"
+ "$ENV{HOME}/NVIDIA_CUDA_SDK_MACOSX"
+ "/Developer/CUDA"
+ )
+
+# Example of how to find an include file from the CUDA_SDK_ROOT_DIR
+
+# find_path(CUDA_CUT_INCLUDE_DIR
+# cutil.h
+# PATHS ${CUDA_SDK_SEARCH_PATH}
+# PATH_SUFFIXES "common/inc"
+# DOC "Location of cutil.h"
+# NO_DEFAULT_PATH
+# )
+# # Now search system paths
+# find_path(CUDA_CUT_INCLUDE_DIR cutil.h DOC "Location of cutil.h")
+
+# mark_as_advanced(CUDA_CUT_INCLUDE_DIR)
+
+
+# Example of how to find a library in the CUDA_SDK_ROOT_DIR
+
+# # cutil library is called cutil64 for 64 bit builds on windows. We don't want
+# # to get these confused, so we are setting the name based on the word size of
+# # the build.
+
+# if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+# set(cuda_cutil_name cutil64)
+# else(CMAKE_SIZEOF_VOID_P EQUAL 8)
+# set(cuda_cutil_name cutil32)
+# endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+
+# find_library(CUDA_CUT_LIBRARY
+# NAMES cutil ${cuda_cutil_name}
+# PATHS ${CUDA_SDK_SEARCH_PATH}
+# # The new version of the sdk shows up in common/lib, but the old one is in lib
+# PATH_SUFFIXES "common/lib" "lib"
+# DOC "Location of cutil library"
+# NO_DEFAULT_PATH
+# )
+# # Now search system paths
+# find_library(CUDA_CUT_LIBRARY NAMES cutil ${cuda_cutil_name} DOC "Location of cutil library")
+# mark_as_advanced(CUDA_CUT_LIBRARY)
+# set(CUDA_CUT_LIBRARIES ${CUDA_CUT_LIBRARY})
+
+
+
+#############################
+# Check for required components
+set(CUDA_FOUND TRUE)
+
+set(CUDA_TOOLKIT_ROOT_DIR_INTERNAL "${CUDA_TOOLKIT_ROOT_DIR}" CACHE INTERNAL
+ "This is the value of the last time CUDA_TOOLKIT_ROOT_DIR was set successfully." FORCE)
+set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL
+ "This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CUDA DEFAULT_MSG
+ CUDA_TOOLKIT_ROOT_DIR
+ CUDA_NVCC_EXECUTABLE
+ CUDA_INCLUDE_DIRS
+ CUDA_CUDART_LIBRARY
+ _cuda_version_acceptable
+ )
+
+
+
+###############################################################################
+###############################################################################
+# Macros
+###############################################################################
+###############################################################################
+
+###############################################################################
+# Add include directories to pass to the nvcc command.
+macro(CUDA_INCLUDE_DIRECTORIES)
+ foreach(dir ${ARGN})
+ list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER "-I${dir}")
+ endforeach(dir ${ARGN})
+endmacro(CUDA_INCLUDE_DIRECTORIES)
+
+
+##############################################################################
+cuda_find_helper_file(parse_cubin cmake)
+cuda_find_helper_file(make2cmake cmake)
+cuda_find_helper_file(run_nvcc cmake)
+
+##############################################################################
+# Separate the OPTIONS out from the sources
+#
+macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options)
+ set( ${_sources} )
+ set( ${_cmake_options} )
+ set( ${_options} )
+ set( _found_options FALSE )
+ foreach(arg ${ARGN})
+ if(arg STREQUAL "OPTIONS")
+ set( _found_options TRUE )
+ elseif(
+ arg STREQUAL "WIN32" OR
+ arg STREQUAL "MACOSX_BUNDLE" OR
+ arg STREQUAL "EXCLUDE_FROM_ALL" OR
+ arg STREQUAL "STATIC" OR
+ arg STREQUAL "SHARED" OR
+ arg STREQUAL "MODULE"
+ )
+ list(APPEND ${_cmake_options} "${arg}")
+ else()
+ if ( _found_options )
+ list(APPEND ${_options} "${arg}")
+ else()
+ # Assume this is a file
+ list(APPEND ${_sources} "${arg}")
+ endif()
+ endif()
+ endforeach()
+endmacro()
+
+##############################################################################
+# Parse the OPTIONS from ARGN and set the variables prefixed by _option_prefix
+#
+macro(CUDA_PARSE_NVCC_OPTIONS _option_prefix)
+ set( _found_config )
+ foreach(arg ${ARGN})
+ # Determine if we are dealing with a perconfiguration flag
+ foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ if (arg STREQUAL "${config_upper}")
+ set( _found_config _${arg})
+ # Set arg to nothing to keep it from being processed further
+ set( arg )
+ endif()
+ endforeach()
+
+ if ( arg )
+ list(APPEND ${_option_prefix}${_found_config} "${arg}")
+ endif()
+ endforeach()
+endmacro()
+
+##############################################################################
+# Helper to add the include directory for CUDA only once
+function(CUDA_ADD_CUDA_INCLUDE_ONCE)
+ get_directory_property(_include_directories INCLUDE_DIRECTORIES)
+ set(_add TRUE)
+ if(_include_directories)
+ foreach(dir ${_include_directories})
+ if("${dir}" STREQUAL "${CUDA_INCLUDE_DIRS}")
+ set(_add FALSE)
+ endif()
+ endforeach()
+ endif()
+ if(_add)
+ include_directories(${CUDA_INCLUDE_DIRS})
+ endif()
+endfunction()
+
+function(CUDA_BUILD_SHARED_LIBRARY shared_flag)
+ set(cmake_args ${ARGN})
+ # If SHARED, MODULE, or STATIC aren't already in the list of arguments, then
+ # add SHARED or STATIC based on the value of BUILD_SHARED_LIBS.
+ list(FIND cmake_args SHARED _cuda_found_SHARED)
+ list(FIND cmake_args MODULE _cuda_found_MODULE)
+ list(FIND cmake_args STATIC _cuda_found_STATIC)
+ if( _cuda_found_SHARED GREATER -1 OR
+ _cuda_found_MODULE GREATER -1 OR
+ _cuda_found_STATIC GREATER -1)
+ set(_cuda_build_shared_libs)
+ else()
+ if (BUILD_SHARED_LIBS)
+ set(_cuda_build_shared_libs SHARED)
+ else()
+ set(_cuda_build_shared_libs STATIC)
+ endif()
+ endif()
+ set(${shared_flag} ${_cuda_build_shared_libs} PARENT_SCOPE)
+endfunction()
+
+##############################################################################
+# This helper macro populates the following variables and setups up custom
+# commands and targets to invoke the nvcc compiler to generate C or PTX source
+# dependant upon the format parameter. The compiler is invoked once with -M
+# to generate a dependency file and a second time with -cuda or -ptx to generate
+# a .cpp or .ptx file.
+# INPUT:
+# cuda_target - Target name
+# format - PTX or OBJ
+# FILE1 .. FILEN - The remaining arguments are the sources to be wrapped.
+# OPTIONS - Extra options to NVCC
+# OUTPUT:
+# generated_files - List of generated files
+##############################################################################
+##############################################################################
+
+macro(CUDA_WRAP_SRCS cuda_target format generated_files)
+
+ if( ${format} MATCHES "PTX" )
+ set( compile_to_ptx ON )
+ elseif( ${format} MATCHES "OBJ")
+ set( compile_to_ptx OFF )
+ else()
+ message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.")
+ endif()
+
+ # Set up all the command line flags here, so that they can be overriden on a per target basis.
+
+ set(nvcc_flags "")
+
+ # Emulation if the card isn't present.
+ if (CUDA_BUILD_EMULATION)
+ # Emulation.
+ set(nvcc_flags ${nvcc_flags} --device-emulation -D_DEVICEEMU -g)
+ else(CUDA_BUILD_EMULATION)
+ # Device mode. No flags necessary.
+ endif(CUDA_BUILD_EMULATION)
+
+ if(CUDA_HOST_COMPILATION_CPP)
+ set(CUDA_C_OR_CXX CXX)
+ else(CUDA_HOST_COMPILATION_CPP)
+ if(CUDA_VERSION VERSION_LESS "3.0")
+ set(nvcc_flags ${nvcc_flags} --host-compilation C)
+ else()
+ message(WARNING "--host-compilation flag is deprecated in CUDA version >= 3.0. Removing --host-compilation C flag" )
+ endif()
+ set(CUDA_C_OR_CXX C)
+ endif(CUDA_HOST_COMPILATION_CPP)
+
+ set(generated_extension ${CMAKE_${CUDA_C_OR_CXX}_OUTPUT_EXTENSION})
+
+ if(CUDA_64_BIT_DEVICE_CODE)
+ set(nvcc_flags ${nvcc_flags} -m64)
+ else()
+ set(nvcc_flags ${nvcc_flags} -m32)
+ endif()
+
+ # This needs to be passed in at this stage, because VS needs to fill out the
+ # value of VCInstallDir from within VS.
+ if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+ # Add nvcc flag for 64b Windows
+ set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
+ endif()
+ endif()
+
+ # Figure out which configure we will use and pass that in as an argument to
+ # the script. We need to defer the decision until compilation time, because
+ # for VS projects we won't know if we are making a debug or release build
+ # until build time.
+ if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set( CUDA_build_configuration "$(ConfigurationName)" )
+ else()
+ set( CUDA_build_configuration "${CMAKE_BUILD_TYPE}")
+ endif()
+
+ # Initialize our list of includes with the user ones followed by the CUDA system ones.
+ set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}")
+ # Get the include directories for this directory and use them for our nvcc command.
+ get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
+ if(CUDA_NVCC_INCLUDE_DIRECTORIES)
+ foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES})
+ list(APPEND CUDA_NVCC_INCLUDE_ARGS "-I${dir}")
+ endforeach()
+ endif()
+
+ # Reset these variables
+ set(CUDA_WRAP_OPTION_NVCC_FLAGS)
+ foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ set(CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper})
+ endforeach()
+
+ CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${ARGN})
+ CUDA_PARSE_NVCC_OPTIONS(CUDA_WRAP_OPTION_NVCC_FLAGS ${_cuda_wrap_options})
+
+ # Figure out if we are building a shared library. BUILD_SHARED_LIBS is
+ # respected in CUDA_ADD_LIBRARY.
+ set(_cuda_build_shared_libs FALSE)
+ # SHARED, MODULE
+ list(FIND _cuda_wrap_cmake_options SHARED _cuda_found_SHARED)
+ list(FIND _cuda_wrap_cmake_options MODULE _cuda_found_MODULE)
+ if(_cuda_found_SHARED GREATER -1 OR _cuda_found_MODULE GREATER -1)
+ set(_cuda_build_shared_libs TRUE)
+ endif()
+ # STATIC
+ list(FIND _cuda_wrap_cmake_options STATIC _cuda_found_STATIC)
+ if(_cuda_found_STATIC GREATER -1)
+ set(_cuda_build_shared_libs FALSE)
+ endif()
+
+ # CUDA_HOST_FLAGS
+ if(_cuda_build_shared_libs)
+ # If we are setting up code for a shared library, then we need to add extra flags for
+ # compiling objects for shared libraries.
+ set(CUDA_HOST_SHARED_FLAGS ${CMAKE_SHARED_LIBRARY_${CUDA_C_OR_CXX}_FLAGS})
+ else()
+ set(CUDA_HOST_SHARED_FLAGS)
+ endif()
+ # Only add the CMAKE_{C,CXX}_FLAGS if we are propagating host flags. We
+ # always need to set the SHARED_FLAGS, though.
+ if(CUDA_PROPAGATE_HOST_FLAGS)
+ set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})")
+ else()
+ set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})")
+ endif()
+
+ set(CUDA_NVCC_FLAGS_CONFIG "# Build specific configuration flags")
+ # Loop over all the configuration types to generate appropriate flags for run_nvcc.cmake
+ foreach(config ${CUDA_configuration_types})
+ string(TOUPPER ${config} config_upper)
+ # CMAKE_FLAGS are strings and not lists. By not putting quotes around CMAKE_FLAGS
+ # we convert the strings to lists (like we want).
+
+ if(CUDA_PROPAGATE_HOST_FLAGS)
+ # nvcc chokes on -g3, so replace it with -g
+ if(CMAKE_COMPILER_IS_GNUCC)
+ string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
+ else()
+ set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
+ endif()
+
+ set(CUDA_HOST_FLAGS "${CUDA_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})")
+ endif()
+
+ # Note that if we ever want CUDA_NVCC_FLAGS_ to be string (instead of a list
+ # like it is currently), we can remove the quotes around the
+ # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_ variable.
+ set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} \"${CUDA_NVCC_FLAGS_${config_upper}};;${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}}\")")
+ endforeach()
+
+ if(compile_to_ptx)
+ # Don't use any of the host compilation flags for PTX targets.
+ set(CUDA_HOST_FLAGS)
+ set(CUDA_NVCC_FLAGS_CONFIG)
+ endif()
+
+ # Get the list of definitions from the directory property
+ get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS)
+ if(CUDA_NVCC_DEFINITIONS)
+ foreach(_definition ${CUDA_NVCC_DEFINITIONS})
+ list(APPEND nvcc_flags "-D${_definition}")
+ endforeach()
+ endif()
+
+ if(_cuda_build_shared_libs)
+ list(APPEND nvcc_flags "-D${cuda_target}_EXPORTS")
+ endif()
+
+ # Determine output directory
+ if(CUDA_GENERATED_OUTPUT_DIR)
+ set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}")
+ else()
+ set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}")
+ endif()
+
+ # Reset the output variable
+ set(_cuda_wrap_generated_files "")
+
+ # Iterate over the macro arguments and create custom
+ # commands for all the .cu files.
+ foreach(file ${ARGN})
+ # Ignore any file marked as a HEADER_FILE_ONLY
+ get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
+ if(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
+
+ # Add a custom target to generate a c or ptx file. ######################
+
+ get_filename_component( basename ${file} NAME )
+ if( compile_to_ptx )
+ set(generated_file_path "${cuda_compile_output_dir}")
+ set(generated_file_basename "${cuda_target}_generated_${basename}.ptx")
+ set(format_flag "-ptx")
+ file(MAKE_DIRECTORY "${cuda_compile_output_dir}")
+ else( compile_to_ptx )
+ set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}")
+ set(generated_file_basename "${cuda_target}_generated_${basename}${generated_extension}")
+ set(format_flag "-c")
+ endif( compile_to_ptx )
+
+ # Set all of our file names. Make sure that whatever filenames that have
+ # generated_file_path in them get passed in through as a command line
+ # argument, so that the ${CMAKE_CFG_INTDIR} gets expanded at run time
+ # instead of configure time.
+ set(generated_file "${generated_file_path}/${generated_file_basename}")
+ set(cmake_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.depend")
+ set(NVCC_generated_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.NVCC-depend")
+ set(generated_cubin_file "${generated_file_path}/${generated_file_basename}.cubin.txt")
+ set(custom_target_script "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.cmake")
+
+ # Setup properties for obj files:
+ if( NOT compile_to_ptx )
+ set_source_files_properties("${generated_file}"
+ PROPERTIES
+ EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked.
+ )
+ endif()
+
+ # Don't add CMAKE_CURRENT_SOURCE_DIR if the path is already an absolute path.
+ get_filename_component(file_path "${file}" PATH)
+ if(IS_ABSOLUTE "${file_path}")
+ set(source_file "${file}")
+ else()
+ set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+ endif()
+
+ # Bring in the dependencies. Creates a variable CUDA_NVCC_DEPEND #######
+ cuda_include_nvcc_dependencies(${cmake_dependency_file})
+
+ # Convience string for output ###########################################
+ if(CUDA_BUILD_EMULATION)
+ set(cuda_build_type "Emulation")
+ else(CUDA_BUILD_EMULATION)
+ set(cuda_build_type "Device")
+ endif(CUDA_BUILD_EMULATION)
+
+ # Build the NVCC made dependency file ###################################
+ set(build_cubin OFF)
+ if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
+ if ( NOT compile_to_ptx )
+ set ( build_cubin ON )
+ endif( NOT compile_to_ptx )
+ endif( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
+
+ # Configure the build script
+ configure_file("${CUDA_run_nvcc}" "${custom_target_script}" @ONLY)
+
+ # So if a user specifies the same cuda file as input more than once, you
+ # can have bad things happen with dependencies. Here we check an option
+ # to see if this is the behavior they want.
+ if(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE)
+ set(main_dep MAIN_DEPENDENCY ${source_file})
+ else()
+ set(main_dep DEPENDS ${source_file})
+ endif()
+
+ if(CUDA_VERBOSE_BUILD)
+ set(verbose_output ON)
+ elseif(CMAKE_GENERATOR MATCHES "Makefiles")
+ set(verbose_output "$(VERBOSE)")
+ else()
+ set(verbose_output OFF)
+ endif()
+
+ # Create up the comment string
+ file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}")
+ if(compile_to_ptx)
+ set(cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}")
+ else()
+ set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}")
+ endif()
+
+ # Build the generated file and dependency file ##########################
+ add_custom_command(
+ OUTPUT ${generated_file}
+ # These output files depend on the source_file and the contents of cmake_dependency_file
+ ${main_dep}
+ DEPENDS ${CUDA_NVCC_DEPEND}
+ DEPENDS ${custom_target_script}
+ # Make sure the output directory exists before trying to write to it.
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${generated_file_path}"
+ COMMAND ${CMAKE_COMMAND} ARGS
+ -D verbose:BOOL=${verbose_output}
+ ${ccbin_flags}
+ -D build_configuration:STRING=${CUDA_build_configuration}
+ -D "generated_file:STRING=${generated_file}"
+ -D "generated_cubin_file:STRING=${generated_cubin_file}"
+ -P "${custom_target_script}"
+ COMMENT "${cuda_build_comment_string}"
+ )
+
+ # Make sure the build system knows the file is generated.
+ set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE)
+
+ # Don't add the object file to the list of generated files if we are using
+ # visual studio and we are attaching the build rule to the cuda file. VS
+ # will add our object file to the linker automatically for us.
+ set(cuda_add_generated_file TRUE)
+
+ if(NOT compile_to_ptx AND CMAKE_GENERATOR MATCHES "Visual Studio" AND CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE)
+ # Visual Studio 8 crashes when you close the solution when you don't add the object file.
+ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 8")
+ #message("Not adding ${generated_file}")
+ set(cuda_add_generated_file FALSE)
+ endif()
+ endif()
+
+ if(cuda_add_generated_file)
+ list(APPEND _cuda_wrap_generated_files ${generated_file})
+ endif()
+
+ # Add the other files that we want cmake to clean on a cleanup ##########
+ list(APPEND CUDA_ADDITIONAL_CLEAN_FILES "${cmake_dependency_file}")
+ list(REMOVE_DUPLICATES CUDA_ADDITIONAL_CLEAN_FILES)
+ set(CUDA_ADDITIONAL_CLEAN_FILES ${CUDA_ADDITIONAL_CLEAN_FILES} CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.")
+
+ endif(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
+ endforeach(file)
+
+ # Set the return parameter
+ set(${generated_files} ${_cuda_wrap_generated_files})
+endmacro(CUDA_WRAP_SRCS)
+
+
+###############################################################################
+###############################################################################
+# ADD LIBRARY
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_LIBRARY cuda_target)
+
+ CUDA_ADD_CUDA_INCLUDE_ONCE()
+
+ # Separate the sources from the options
+ CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+ CUDA_BUILD_SHARED_LIBRARY(_cuda_shared_flag ${ARGN})
+ # Create custom commands and targets for each file.
+ CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources}
+ ${_cmake_options} ${_cuda_shared_flag}
+ OPTIONS ${_options} )
+
+ # Add the library.
+ add_library(${cuda_target} ${_cmake_options}
+ ${_generated_files}
+ ${_sources}
+ )
+
+ target_link_libraries(${cuda_target}
+ ${CUDA_LIBRARIES}
+ )
+
+ # We need to set the linker language based on what the expected generated file
+ # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
+ set_target_properties(${cuda_target}
+ PROPERTIES
+ LINKER_LANGUAGE ${CUDA_C_OR_CXX}
+ )
+
+endmacro(CUDA_ADD_LIBRARY cuda_target)
+
+
+###############################################################################
+###############################################################################
+# ADD EXECUTABLE
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_EXECUTABLE cuda_target)
+
+ CUDA_ADD_CUDA_INCLUDE_ONCE()
+
+ # Separate the sources from the options
+ CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+ # Create custom commands and targets for each file.
+ CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources} OPTIONS ${_options} )
+
+ # Add the library.
+ add_executable(${cuda_target} ${_cmake_options}
+ ${_generated_files}
+ ${_sources}
+ )
+
+ target_link_libraries(${cuda_target}
+ ${CUDA_LIBRARIES}
+ )
+
+ # We need to set the linker language based on what the expected generated file
+ # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
+ set_target_properties(${cuda_target}
+ PROPERTIES
+ LINKER_LANGUAGE ${CUDA_C_OR_CXX}
+ )
+
+endmacro(CUDA_ADD_EXECUTABLE cuda_target)
+
+
+###############################################################################
+###############################################################################
+# CUDA COMPILE
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE generated_files)
+
+ # Separate the sources from the options
+ CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+ # Create custom commands and targets for each file.
+ CUDA_WRAP_SRCS( cuda_compile OBJ _generated_files ${_sources} ${_cmake_options}
+ OPTIONS ${_options} )
+
+ set( ${generated_files} ${_generated_files})
+
+endmacro(CUDA_COMPILE)
+
+
+###############################################################################
+###############################################################################
+# CUDA COMPILE PTX
+###############################################################################
+###############################################################################
+macro(CUDA_COMPILE_PTX generated_files)
+
+ # Separate the sources from the options
+ CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
+ # Create custom commands and targets for each file.
+ CUDA_WRAP_SRCS( cuda_compile_ptx PTX _generated_files ${_sources} ${_cmake_options}
+ OPTIONS ${_options} )
+
+ set( ${generated_files} ${_generated_files})
+
+endmacro(CUDA_COMPILE_PTX)
+
+###############################################################################
+###############################################################################
+# CUDA ADD CUFFT TO TARGET
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_CUFFT_TO_TARGET target)
+ if (CUDA_BUILD_EMULATION)
+ target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY})
+ else()
+ target_link_libraries(${target} ${CUDA_cufft_LIBRARY})
+ endif()
+endmacro()
+
+###############################################################################
+###############################################################################
+# CUDA ADD CUBLAS TO TARGET
+###############################################################################
+###############################################################################
+macro(CUDA_ADD_CUBLAS_TO_TARGET target)
+ if (CUDA_BUILD_EMULATION)
+ target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
+ else()
+ target_link_libraries(${target} ${CUDA_cublas_LIBRARY})
+ endif()
+endmacro()
+
+###############################################################################
+###############################################################################
+# CUDA BUILD CLEAN TARGET
+###############################################################################
+###############################################################################
+macro(CUDA_BUILD_CLEAN_TARGET)
+ # Call this after you add all your CUDA targets, and you will get a convience
+ # target. You should also make clean after running this target to get the
+ # build system to generate all the code again.
+
+ set(cuda_clean_target_name clean_cuda_depends)
+ if (CMAKE_GENERATOR MATCHES "Visual Studio")
+ string(TOUPPER ${cuda_clean_target_name} cuda_clean_target_name)
+ endif()
+ add_custom_target(${cuda_clean_target_name}
+ COMMAND ${CMAKE_COMMAND} -E remove ${CUDA_ADDITIONAL_CLEAN_FILES})
+
+ # Clear out the variable, so the next time we configure it will be empty.
+ # This is useful so that the files won't persist in the list after targets
+ # have been removed.
+ set(CUDA_ADDITIONAL_CLEAN_FILES "" CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.")
+endmacro(CUDA_BUILD_CLEAN_TARGET)
diff --git a/ParadisEO-GPU/CMake/cuda/FindCUDA/make2cmake.cmake b/ParadisEO-GPU/CMake/cuda/FindCUDA/make2cmake.cmake
new file mode 100644
index 000000000..7fce167c2
--- /dev/null
+++ b/ParadisEO-GPU/CMake/cuda/FindCUDA/make2cmake.cmake
@@ -0,0 +1,79 @@
+# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
+# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
+#
+# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
+#
+# Copyright (c) 2007-2009
+# Scientific Computing and Imaging Institute, University of Utah
+#
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+#######################################################################
+# This converts a file written in makefile syntax into one that can be included
+# by CMake.
+
+file(READ ${input_file} depend_text)
+
+if (${depend_text} MATCHES ".+")
+
+ # message("FOUND DEPENDS")
+
+ # Remember, four backslashes is escaped to one backslash in the string.
+ string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
+
+ # This works for the nvcc -M generated dependency files.
+ string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
+ string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
+
+ set(dependency_list "")
+
+ foreach(file ${depend_text})
+
+ string(REGEX REPLACE "^ +" "" file ${file})
+
+ if(NOT IS_DIRECTORY ${file})
+ # If softlinks start to matter, we should change this to REALPATH. For now we need
+ # to flatten paths, because nvcc can generate stuff like /bin/../include instead of
+ # just /include.
+ get_filename_component(file_absolute "${file}" ABSOLUTE)
+ list(APPEND dependency_list "${file_absolute}")
+ endif(NOT IS_DIRECTORY ${file})
+
+ endforeach(file)
+
+else()
+ # message("FOUND NO DEPENDS")
+endif()
+
+# Remove the duplicate entries and sort them.
+list(REMOVE_DUPLICATES dependency_list)
+list(SORT dependency_list)
+
+foreach(file ${dependency_list})
+ set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
+endforeach()
+
+file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
diff --git a/ParadisEO-GPU/CMake/cuda/FindCUDA/parse_cubin.cmake b/ParadisEO-GPU/CMake/cuda/FindCUDA/parse_cubin.cmake
new file mode 100644
index 000000000..2518c6852
--- /dev/null
+++ b/ParadisEO-GPU/CMake/cuda/FindCUDA/parse_cubin.cmake
@@ -0,0 +1,112 @@
+# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
+# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
+#
+# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
+#
+# Copyright (c) 2007-2009
+# Scientific Computing and Imaging Institute, University of Utah
+#
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+#######################################################################
+# Parses a .cubin file produced by nvcc and reports statistics about the file.
+
+
+file(READ ${input_file} file_text)
+
+if (${file_text} MATCHES ".+")
+
+ # Remember, four backslashes is escaped to one backslash in the string.
+ string(REGEX REPLACE ";" "\\\\;" file_text ${file_text})
+ string(REGEX REPLACE "\ncode" ";code" file_text ${file_text})
+
+ list(LENGTH file_text len)
+
+ foreach(line ${file_text})
+
+ # Only look at "code { }" blocks.
+ if(line MATCHES "^code")
+
+ # Break into individual lines.
+ string(REGEX REPLACE "\n" ";" line ${line})
+
+ foreach(entry ${line})
+
+ # Extract kernel names.
+ if (${entry} MATCHES "[^g]name = ([^ ]+)")
+ string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
+
+ # Check to see if the kernel name starts with "_"
+ set(skip FALSE)
+ # if (${entry} MATCHES "^_")
+ # Skip the rest of this block.
+ # message("Skipping ${entry}")
+ # set(skip TRUE)
+ # else (${entry} MATCHES "^_")
+ message("Kernel: ${entry}")
+ # endif (${entry} MATCHES "^_")
+
+ endif(${entry} MATCHES "[^g]name = ([^ ]+)")
+
+ # Skip the rest of the block if necessary
+ if(NOT skip)
+
+ # Registers
+ if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
+ string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ message("Registers: ${entry}")
+ endif()
+
+ # Local memory
+ if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
+ string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ message("Local: ${entry}")
+ endif()
+
+ # Shared memory
+ if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
+ string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
+ message("Shared: ${entry}")
+ endif()
+
+ if (${entry} MATCHES "^}")
+ message("")
+ endif()
+
+ endif(NOT skip)
+
+
+ endforeach(entry)
+
+ endif(line MATCHES "^code")
+
+ endforeach(line)
+
+else()
+ # message("FOUND NO DEPENDS")
+endif()
+
+
diff --git a/ParadisEO-GPU/CMake/cuda/FindCUDA/run_nvcc.cmake b/ParadisEO-GPU/CMake/cuda/FindCUDA/run_nvcc.cmake
new file mode 100644
index 000000000..7349da322
--- /dev/null
+++ b/ParadisEO-GPU/CMake/cuda/FindCUDA/run_nvcc.cmake
@@ -0,0 +1,280 @@
+# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
+#
+# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
+#
+# This code is licensed under the MIT License. See the FindCUDA.cmake script
+# for the text of the license.
+
+# The MIT License
+#
+# License for the specific language governing rights and limitations under
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+
+##########################################################################
+# This file runs the nvcc commands to produce the desired output file along with
+# the dependency file needed by CMake to compute dependencies. In addition the
+# file checks the output of each command and if the command fails it deletes the
+# output files.
+
+# Input variables
+#
+# verbose:BOOL=<> OFF: Be as quiet as possible (default)
+# ON : Describe each step
+#
+# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
+# RelWithDebInfo, but it should match one of the
+# entries in CUDA_HOST_FLAGS. This is the build
+# configuration used when compiling the code. If
+# blank or unspecified Debug is assumed as this is
+# what CMake does.
+#
+# generated_file:STRING=<> File to generate. This argument must be passed in.
+#
+# generated_cubin_file:STRING=<> File to generate. This argument must be passed
+# in if build_cubin is true.
+
+if(NOT generated_file)
+ message(FATAL_ERROR "You must specify generated_file on the command line")
+endif()
+
+# Set these up as variables to make reading the generated file easier
+set(CMAKE_COMMAND "@CMAKE_COMMAND@")
+set(source_file "@source_file@")
+set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@")
+set(cmake_dependency_file "@cmake_dependency_file@")
+set(CUDA_make2cmake "@CUDA_make2cmake@")
+set(CUDA_parse_cubin "@CUDA_parse_cubin@")
+set(build_cubin @build_cubin@)
+# We won't actually use these variables for now, but we need to set this, in
+# order to force this file to be run again if it changes.
+set(generated_file_path "@generated_file_path@")
+set(generated_file_internal "@generated_file@")
+set(generated_cubin_file_internal "@generated_cubin_file@")
+
+set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@")
+set(CUDA_NVCC_FLAGS "@CUDA_NVCC_FLAGS@;;@CUDA_WRAP_OPTION_NVCC_FLAGS@")
+@CUDA_NVCC_FLAGS_CONFIG@
+set(nvcc_flags "@nvcc_flags@")
+set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@")
+set(format_flag "@format_flag@")
+
+if(build_cubin AND NOT generated_cubin_file)
+ message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
+endif()
+
+# This is the list of host compilation flags. It C or CXX should already have
+# been chosen by FindCUDA.cmake.
+@CUDA_HOST_FLAGS@
+
+# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
+set(nvcc_host_compiler_flags "")
+# If we weren't given a build_configuration, use Debug.
+if(NOT build_configuration)
+ set(build_configuration Debug)
+endif()
+string(TOUPPER "${build_configuration}" build_configuration)
+#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
+foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
+ # Extra quotes are added around each flag to help nvcc parse out flags with spaces.
+ set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
+endforeach()
+if (nvcc_host_compiler_flags)
+ set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
+endif()
+#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
+# Add the build specific configuration flags
+list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
+
+if(DEFINED CCBIN)
+ set(CCBIN -ccbin "${CCBIN}")
+endif()
+
+# cuda_execute_process - Executes a command with optional command echo and status message.
+#
+# status - Status message to print if verbose is true
+# command - COMMAND argument from the usual execute_process argument structure
+# ARGN - Remaining arguments are the command with arguments
+#
+# CUDA_result - return value from running the command
+#
+# Make this a macro instead of a function, so that things like RESULT_VARIABLE
+# and other return variables are present after executing the process.
+macro(cuda_execute_process status command)
+ set(_command ${command})
+ if(NOT _command STREQUAL "COMMAND")
+ message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
+ endif()
+ if(verbose)
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
+ # Now we need to build up our command string. We are accounting for quotes
+ # and spaces, anything else is left up to the user to fix if they want to
+ # copy and paste a runnable command line.
+ set(cuda_execute_process_string)
+ foreach(arg ${ARGN})
+ # If there are quotes, excape them, so they come through.
+ string(REPLACE "\"" "\\\"" arg ${arg})
+ # Args with spaces need quotes around them to get them to be parsed as a single argument.
+ if(arg MATCHES " ")
+ list(APPEND cuda_execute_process_string "\"${arg}\"")
+ else()
+ list(APPEND cuda_execute_process_string ${arg})
+ endif()
+ endforeach()
+ # Echo the command
+ execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
+ endif(verbose)
+ # Run the command
+ execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
+endmacro()
+
+# Delete the target file
+cuda_execute_process(
+ "Removing ${generated_file}"
+ COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
+ )
+
+# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
+# for dependency generation and hope for the best.
+set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
+set(CUDA_VERSION @CUDA_VERSION@)
+if(CUDA_VERSION VERSION_LESS "3.0")
+ cmake_policy(PUSH)
+ # CMake policy 0007 NEW states that empty list elements are not
+ # ignored. I'm just setting it to avoid the warning that's printed.
+ cmake_policy(SET CMP0007 NEW)
+ # Note that this will remove all occurances of -G.
+ list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
+ cmake_policy(POP)
+endif()
+
+# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
+# can cause incorrect dependencies when #including files based on this macro which is
+# defined in the generating passes of nvcc invokation. We will go ahead and manually
+# define this for now until a future version fixes this bug.
+set(CUDACC_DEFINE -D__CUDACC__)
+
+# Generate the dependency file
+cuda_execute_process(
+ "Generating dependency file: ${NVCC_generated_dependency_file}"
+ COMMAND "${CUDA_NVCC_EXECUTABLE}"
+ -M
+ ${CUDACC_DEFINE}
+ "${source_file}"
+ -o "${NVCC_generated_dependency_file}"
+ ${CCBIN}
+ ${nvcc_flags}
+ ${nvcc_host_compiler_flags}
+ ${depends_CUDA_NVCC_FLAGS}
+ -DNVCC
+ ${CUDA_NVCC_INCLUDE_ARGS}
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Generate the cmake readable dependency file to a temp file. Don't put the
+# quotes just around the filenames for the input_file and output_file variables.
+# CMake will pass the quotes through and not be able to find the file.
+cuda_execute_process(
+ "Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
+ COMMAND "${CMAKE_COMMAND}"
+ -D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
+ -D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
+ -P "${CUDA_make2cmake}"
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Copy the file if it is different
+cuda_execute_process(
+ "Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Delete the temporary file
+cuda_execute_process(
+ "Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
+ COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
+ )
+
+if(CUDA_result)
+ message(FATAL_ERROR "Error generating ${generated_file}")
+endif()
+
+# Generate the code
+cuda_execute_process(
+ "Generating ${generated_file}"
+ COMMAND "${CUDA_NVCC_EXECUTABLE}"
+ "${source_file}"
+ ${format_flag} -o "${generated_file}"
+ ${CCBIN}
+ ${nvcc_flags}
+ ${nvcc_host_compiler_flags}
+ ${CUDA_NVCC_FLAGS}
+ -DNVCC
+ ${CUDA_NVCC_INCLUDE_ARGS}
+ )
+
+if(CUDA_result)
+ # Since nvcc can sometimes leave half done files make sure that we delete the output file.
+ cuda_execute_process(
+ "Removing ${generated_file}"
+ COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
+ )
+ message(FATAL_ERROR "Error generating file ${generated_file}")
+else()
+ if(verbose)
+ message("Generated ${generated_file} successfully.")
+ endif()
+endif()
+
+# Cubin resource report commands.
+if( build_cubin )
+ # Run with -cubin to produce resource usage report.
+ cuda_execute_process(
+ "Generating ${generated_cubin_file}"
+ COMMAND "${CUDA_NVCC_EXECUTABLE}"
+ "${source_file}"
+ ${CUDA_NVCC_FLAGS}
+ ${nvcc_flags}
+ ${CCBIN}
+ ${nvcc_host_compiler_flags}
+ -DNVCC
+ -cubin
+ -o "${generated_cubin_file}"
+ ${CUDA_NVCC_INCLUDE_ARGS}
+ )
+
+ # Execute the parser script.
+ cuda_execute_process(
+ "Executing the parser script"
+ COMMAND "${CMAKE_COMMAND}"
+ -D "input_file:STRING=${generated_cubin_file}"
+ -P "${CUDA_parse_cubin}"
+ )
+
+endif( build_cubin )
diff --git a/ParadisEO-GPU/CMakeLists.txt b/ParadisEO-GPU/CMakeLists.txt
new file mode 100644
index 000000000..4a6c0cc78
--- /dev/null
+++ b/ParadisEO-GPU/CMakeLists.txt
@@ -0,0 +1,132 @@
+######################################################################################
+### 0) Set your application properties
+######################################################################################
+# check cmake version compatibility
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+# Here define your project name
+PROJECT(Paradiseo-GPU)
+
+SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE)
+SET(PACKAGE_NAME "ParadisEO-GPU - Moving Objects GPU" CACHE STRING "Package name" FORCE)
+SET(PACKAGE_STRING "ParadisEO-GPU 1.0" CACHE STRING "GPU Package string full name" FORCE)
+SET(PACKAGE_VERSION "1.0" CACHE STRING "Package version" FORCE)
+SET(GLOBAL_VERSION "1.0" CACHE STRING "Global version" FORCE)
+SET(VERSION "1.0.0" CACHE STRING "Version" FORCE)
+
+# regular expression checking
+INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
+
+# set a language for the entire project.
+ENABLE_LANGUAGE(CXX)
+ENABLE_LANGUAGE(C)
+
+######################################################################################
+
+ ##########################################
+ # Find Cuda package #
+ ##########################################
+
+
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/cuda" ${CMAKE_MODULE_PATH})
+find_package(CUDA QUIET REQUIRED)
+
+# Check if CUDA was found
+ if (CUDA_FOUND)
+ message("CUDA found")
+ else()
+ message("CUDA not found")
+ endif()
+
+######################################################################################
+### 1) Include the install configuration file where are defined the main variables
+######################################################################################
+
+INCLUDE(${CMAKE_SOURCE_DIR}/install.cmake)
+
+######################################################################################
+
+######################################################################################
+### 2) Include the sources
+######################################################################################
+
+ ##########################################
+ # Include required modules & utilities #
+ ##########################################
+
+INCLUDE(CMakeBackwardCompatibilityCXX)
+
+INCLUDE(FindDoxygen)
+
+INCLUDE(CheckLibraryExists)
+
+INCLUDE(Dart OPTIONAL)
+
+# Set a special flag if the environment is windows (should do the same in a config.g file)
+IF (WIN32)
+ ADD_DEFINITIONS(-D_WINDOWS=1)
+ENDIF (WIN32)
+
+######################################################################################
+
+ #########################
+ # Manage the build type #
+ #########################
+
+# the user should choose the build type on windows environments,excepted under cygwin (default=none)
+SET(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "Variable that stores the default CMake build type" FORCE)
+
+FIND_PROGRAM(MEMORYCHECK_COMMAND
+ NAMES purify valgrind
+ PATHS
+ "/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
+ DOC "Path to the memory checking command, used for memory error detection.")
+
+IF(NOT CMAKE_BUILD_TYPE)
+ SET( CMAKE_BUILD_TYPE
+ ${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
+ "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
+ FORCE)
+ENDIF(NOT CMAKE_BUILD_TYPE)
+
+IF(WIN32 AND NOT CYGWIN)
+ IF(CMAKE_CXX_COMPILER MATCHES cl)
+ IF(NOT WITH_SHARED_LIBS)
+ IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
+ SET(CMAKE_CXX_FLAGS "/nologo /Gy")
+ SET(CMAKE_CXX_FLAGS_DEBUG "/W3 /MTd /Z7 /Od")
+ SET(CMAKE_CXX_FLAGS_RELEASE "/w /MT /O2 /wd4530")
+ SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
+ ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008")
+ ENDIF(NOT WITH_SHARED_LIBS)
+ ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
+ELSE(WIN32 AND NOT CYGWIN)
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter")
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
+ SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6")
+ ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+ENDIF(WIN32 AND NOT CYGWIN)
+
+IF(CMAKE_BUILD_TYPE MATCHES Debug)
+ ADD_DEFINITIONS(-DCMAKE_VERBOSE_MAKEFILE=ON)
+ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
+
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${PARADISEO_GPU_SRC_DIR}/CTestCustom.cmake
+ ${PARADISEO_GPU_BIN_DIR}/CTestCustom.cmake)
+##########################################################################################################################################
+######################################################################################
+### 3) Link the librairies for your executable
+######################################################################################
+
+ADD_SUBDIRECTORY(doc)
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(test)
+ADD_SUBDIRECTORY(tutoriel)
+
+######################################################################################
+
diff --git a/ParadisEO-GPU/CTestConfig.cmake b/ParadisEO-GPU/CTestConfig.cmake
new file mode 100644
index 000000000..465d208d6
--- /dev/null
+++ b/ParadisEO-GPU/CTestConfig.cmake
@@ -0,0 +1,7 @@
+set(CTEST_PROJECT_NAME "ParadisEO")
+set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
+
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "cdash.inria.fr")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ParadisEO")
+set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/ParadisEO-GPU/CTestCustom.cmake b/ParadisEO-GPU/CTestCustom.cmake
new file mode 100644
index 000000000..537349451
--- /dev/null
+++ b/ParadisEO-GPU/CTestCustom.cmake
@@ -0,0 +1,9 @@
+SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
+ ${CTEST_CUSTOM_COVERAGE_EXCLUDE}
+"test/"
+"paradiseo-eo/"
+"paradiseo-mo/"
+"paradiseo-moeo/"
+"problems/"
+"tutorial/"
+)
diff --git a/ParadisEO-GPU/README.txt b/ParadisEO-GPU/README.txt
new file mode 100644
index 000000000..f8e218c6d
--- /dev/null
+++ b/ParadisEO-GPU/README.txt
@@ -0,0 +1,37 @@
+This package contains the source for ParadisEO-GPU problems.
+
+# Step 1 - Configuration
+------------------------
+Edit the "install.cmake" file by entering the FULL PATH of :
+
+-"ParadisEO_PATH" where Paradiseo directory has been installed in your host.
+-"ParadisEO-GPU_PATH" where ParadisEO-GPU package has been decompressed in your host.
+-"CUDA_PATH" where CUDA has been installed in your host.
+-"NVIDIA_PATH" where NVIDIA has been installed in your host.
+
+
+# Step 2 - Build process
+------------------------
+ParadisEO is assumed to be compiled. To download ParadisEO, please visit http://paradiseo.gforge.inria.fr/.
+Go to the ParadisEO-GPU/build/ directory and lunch cmake:
+(Unix) > cmake .. -DENABLE_CMAKE_TESTING=TRUE -DCMAKE_BUILD_TYPE=Debug
+
+
+# Step 3 - Compilation
+----------------------
+In the ParadisEO-GPU/build/ directory:
+(Unix) > make
+
+# Step 4 - Execution
+---------------------
+A toy example is given to test the components. You can run these tests as following.
+To define problem-related components for your own problem, please refer to the tutorials available on the website : http://paradiseo.gforge.inria.fr/.
+In the ParadisEO-GPU/build/ directory:
+(Unix) > ctest -D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest -D ExperimentalSubmit
+
+In the directory "tutorial", there is an example of One Max problem which illustrate how to use this package.
+
+# Documentation
+---------------
+The API-documentation is available in doc/html/index.html
+
diff --git a/ParadisEO-GPU/doc/CMakeLists.txt b/ParadisEO-GPU/doc/CMakeLists.txt
new file mode 100644
index 000000000..64e967d1c
--- /dev/null
+++ b/ParadisEO-GPU/doc/CMakeLists.txt
@@ -0,0 +1,25 @@
+##########################################################################################
+### Doc generation using Doxygen
+##########################################################################################
+
+IF (DOXYGEN_FOUND)
+
+ SET(DOC_DIR ${CMAKE_BINARY_DIR}/doc CACHE PATH "GPU documentation directory")
+ SET(GPU_DOC_CONFIG_FILE "doxyfile" CACHE PATH "GPU documentation configuration file")
+ # define the doc target
+ IF (DOXYGEN_EXECUTABLE)
+ ADD_CUSTOM_TARGET(doc
+ COMMAND ${DOXYGEN_EXECUTABLE} ${GPU_DOC_CONFIG_FILE}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ ENDIF (DOXYGEN_EXECUTABLE)
+
+ # configure doxyfile file
+ CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/doc/${GPU_DOC_CONFIG_FILE}.cmake"
+ "${CMAKE_BINARY_DIR}/doc/${GPU_DOC_CONFIG_FILE}")
+
+ELSE (DOXYGEN_FOUND)
+ MESSAGE(STATUS "Unable to generate the documentation, Doxygen package not found")
+ENDIF (DOXYGEN_FOUND)
+
+##########################################################################################
diff --git a/ParadisEO-GPU/doc/doxyfile.cmake b/ParadisEO-GPU/doc/doxyfile.cmake
new file mode 100644
index 000000000..9a0795ba1
--- /dev/null
+++ b/ParadisEO-GPU/doc/doxyfile.cmake
@@ -0,0 +1,240 @@
+# Doxyfile 1.5.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = @PACKAGE_NAME@
+PROJECT_NUMBER = @PACKAGE_VERSION@
+OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = YES
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = NO
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = NO
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = YES
+WARNINGS = NO
+WARN_IF_UNDOCUMENTED = NO
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = @CMAKE_SOURCE_DIR@
+FILE_PATTERNS = *.cu \
+ *.cpp \
+ *.h \
+ NEWS README
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 3
+IGNORE_PREFIX =
+#moeo
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = YES
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = YES
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES = @PARADISEO_EO_BIN_DIR@/doc/eo.doxytag=http://eodev.sourceforge.net/eo/doc/html \
+ @PARADISEO_MO_BIN_DIR@/doc/mo.doxytag=http://paradiseo.gforge.inria.fr/addon/paradiseo-mo/doc/
+
+GENERATE_TAGFILE = @CMAKE_BINARY_DIR@/doc/mogpu.doxytag
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = YES
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 10
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = YES
diff --git a/ParadisEO-GPU/doc/index.h b/ParadisEO-GPU/doc/index.h
new file mode 100644
index 000000000..f6bedcac8
--- /dev/null
+++ b/ParadisEO-GPU/doc/index.h
@@ -0,0 +1,58 @@
+/** @mainpage Welcome ParadisEO GPU
+
+@section intro Introduction
+
+ParadisEO-GPU is a white-box object-oriented generic framework dedicated to the flexible design of local search algorithms on GPU (hill-climbing, tabu search ...)
+
+@section tutorials Tutorials
+
+Tutorials for ParadisEO-GPU are available in the "Tutorials section" of the ParadisEO tutorials.
+
+@section install Installation
+
+The installation procedure of the package is detailed in the "README.txt" file located in the top-directory of the source-tree.
+
+
+@section design Design
+
+For an introduction to the design of ParadisEO,
+you can look at the ParadisEO website.
+
+
+@section LICENSE
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+
+*/
+
+/** @page webpages Related webpages
+
+- ParadisEO homepage
+- INRIA GForge project page
+- Fore any questions, please contact paradiseo-help@lists.gforge.inria.fr
+*/
diff --git a/ParadisEO-GPU/install.cmake b/ParadisEO-GPU/install.cmake
new file mode 100644
index 000000000..c8dae0830
--- /dev/null
+++ b/ParadisEO-GPU/install.cmake
@@ -0,0 +1,43 @@
+#########################################################################################################
+# 1) ParadisEO-GPU install: SIMPLE Configuration
+#########################################################################################################
+
+# Here, just specify PARADISEO_DIR : the directory where ParadisEO has been installed
+SET(PARADISEO_DIR "/home/mia/workspace/trunk" CACHE PATH "ParadisEO directory" FORCE)
+
+# Here, just specify CUDA_DIR : the directory where CUDA has been installed
+SET(CUDA_DIR "/usr/local/cuda" CACHE PATH "CUDA directory" FORCE)
+
+# Here, just specify NVIDIA_DIR : the directory where NVIDIA header has been installed
+SET(NVIDIA_DIR "/home/mia/NVIDIA_GPU_Computing_SDK" CACHE PATH "NVIDIA directory" FORCE)
+
+# Here, just specify GPU_DIR : the directory where package Paradiseo GPU has been extrated
+SET(PARADISEO_GPU_DIR "/home/mia/workspace/ParadisEO-GPU" CACHE PATH "ParadisEO-GPU directory" FORCE)
+#########################################################################################################
+# 2) ParadisEO-GPU install: ADVANCED Configuration
+#########################################################################################################
+
+SET(NVIDIA_SRC_DIR "${NVIDIA_DIR}/C/common/inc" CACHE PATH "NVIDIA source directory" FORCE)
+SET(NVIDIA_LIB_DIR "${NVIDIA_DIR}/C/lib" CACHE PATH "NVIDIA library directory" FORCE)
+
+SET(CUDA_SRC_DIR "${CUDA_DIR}/include" CACHE PATH "CUDA source directory" FORCE)
+SET(CUDA_LIB_DIR "${CUDA_DIR}/lib" CACHE PATH "CUDA library directory" FORCE)
+
+SET(PARADISEO_EO_SRC_DIR "${PARADISEO_DIR}/paradiseo-eo" CACHE PATH "ParadisEO-EO source directory" FORCE)
+SET(PARADISEO_EO_BIN_DIR "${PARADISEO_DIR}/paradiseo-eo/build" CACHE PATH "ParadisEO-EO binary directory" FORCE)
+
+SET(PARADISEO_MO_SRC_DIR "${PARADISEO_DIR}/paradiseo-mo" CACHE PATH "ParadisEO-MO source directory" FORCE)
+SET(PARADISEO_MO_BIN_DIR "${PARADISEO_DIR}/paradiseo-mo/build" CACHE PATH "ParadisEO-MO binary directory" FORCE)
+
+SET(PARADISEO_MOEO_SRC_DIR "${PARADISEO_DIR}/paradiseo-moeo" CACHE PATH "ParadisEO-MOEO source directory" FORCE)
+SET(PARADISEO_MOEO_BIN_DIR "${PARADISEO_DIR}/paradiseo-moeo/build" CACHE PATH "ParadisEO-MOEO binary directory" FORCE)
+
+SET(PARADISEO_PEO_SRC_DIR "${PARADISEO_DIR}/paradiseo-peo" CACHE PATH "ParadisEO-PEO source directory" FORCE)
+SET(PARADISEO_PEO_BIN_DIR "${PARADISEO_DIR}/paradiseo-peo/build" CACHE PATH "ParadisEO-PEO binary directory" FORCE)
+
+SET(PARADISEO_GPU_SRC_DIR "${PARADISEO_GPU_DIR}/src" CACHE PATH "ParadisEO-GPU source directory" FORCE)
+SET(PARADISEO_GPU_BIN_DIR "${PARADISEO_GPU_DIR}/build" CACHE PATH "ParadisEO-GPU binary directory" FORCE)
+
+SET(PARADISEO_PROBLEMS_SRC_DIR "${PARADISEO_DIR}/problems" CACHE PATH "ParadisEO-problems source directory" FORCE)
+
+#########################################################################################################
diff --git a/ParadisEO-GPU/src/cudaType/moCudaBitVector.h b/ParadisEO-GPU/src/cudaType/moCudaBitVector.h
new file mode 100644
index 000000000..56e926887
--- /dev/null
+++ b/ParadisEO-GPU/src/cudaType/moCudaBitVector.h
@@ -0,0 +1,107 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaBitVector_H_
+#define _moCudaBitVector_H_
+
+#include
+
+/**
+ * Implementation of Bit vector representation on CUDA.
+ */
+
+template
+
+class moCudaBitVector: public moCudaVector {
+
+public:
+
+ using moCudaVector::vect;
+ using moCudaVector::N;
+
+ /**
+ * Default constructor.
+ */
+
+ moCudaBitVector() :
+ moCudaVector () {
+
+ }
+
+ /**
+ *Constructor.
+ *@param _size The neighborhood size.
+ */
+
+ moCudaBitVector(unsigned _size) {
+
+ N = _size;
+
+ vect = new bool[_size];
+
+ create();
+ }
+
+ /**
+ *Constructor.
+ *@param _size The neighborhood size.
+ *@param _b Value to assign to vector.
+ */
+
+ moCudaBitVector(unsigned _size, bool _b) {
+
+ N = _size;
+
+ vect = new bool[_size];
+
+ for (unsigned i = 0; i < _size; i++)
+ vect[i] = _b;
+ }
+
+ /**
+ *Initializer of random bit vector.
+ */
+
+ void create() {
+
+ for (unsigned i = 0; i < N; i++) {
+
+ vect[i] = (bool) round((float) rand() / RAND_MAX);
+
+ }
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/cudaType/moCudaIntVector.h b/ParadisEO-GPU/src/cudaType/moCudaIntVector.h
new file mode 100644
index 000000000..40557f853
--- /dev/null
+++ b/ParadisEO-GPU/src/cudaType/moCudaIntVector.h
@@ -0,0 +1,114 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaIntVector_H_
+#define _moCudaIntVector_H_
+
+#include
+
+/**
+ * Implementation of integer vector representation on CUDA.
+ */
+
+template
+
+class moCudaIntVector: public moCudaVector {
+
+public:
+
+ using moCudaVector::vect;
+ using moCudaVector::N;
+
+
+ /**
+ * Default constructor.
+ */
+
+ moCudaIntVector() :
+ moCudaVector () {
+
+ }
+
+ /**
+ *Constructor.
+ *@param _size The neighborhood size.
+ */
+
+ moCudaIntVector(unsigned _size) {
+
+ N = _size;
+
+ vect = new int[_size];
+
+ create();
+ }
+
+ /**
+ *Assignment operator
+ *@param _vector The vector passed to the function determine the new content.
+ *@return a new vector.
+ */
+
+ virtual moCudaIntVector& operator=(const moCudaIntVector & _vector) {
+
+ N = _vector.N;
+ vect = new int[N];
+ for (unsigned i = 0; i < N; i++)
+ vect[i] = _vector.vect[i];
+ fitness(_vector.fitness());
+ return (*this);
+
+ }
+
+ /**
+ *Initializer of random integer vector.
+ */
+ void create() {
+
+ unsigned random;
+ int temp;
+ for (unsigned i = 0; i < N; i++)
+ vect[i] = i;
+ // we want a random permutation so we shuffle
+ for (unsigned i = 0; i < N; i++) {
+ random = rand() % (N - i) + i;
+ temp = vect[i];
+ vect[i] = vect[random];
+ vect[random] = temp;
+ }
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/cudaType/moCudaVector.h b/ParadisEO-GPU/src/cudaType/moCudaVector.h
new file mode 100644
index 000000000..38ef72f11
--- /dev/null
+++ b/ParadisEO-GPU/src/cudaType/moCudaVector.h
@@ -0,0 +1,150 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaVector_H_
+#define _moCudaVector_H_
+
+#include
+
+/**
+ * Implementation of vector representation on CUDA.
+ */
+
+template
+
+class moCudaVector: public EO {
+
+public:
+
+ typedef ElemT ElemType;
+
+ ElemType * vect;
+ unsigned N;
+
+ /**
+ * Default constructor.
+ */
+
+ moCudaVector() :
+ N(1) {
+ }
+
+ /**
+ *Constructor.
+ *@param _size The neighborhood size.
+ */
+
+ moCudaVector(unsigned _size) {
+
+ N = _size;
+
+ vect = new ElemType[_size];
+
+ create();
+ }
+
+ /**
+ * Destructor.
+ */
+
+ ~moCudaVector() {
+ if (N > 1)
+ delete[] vect;
+ }
+
+ /**
+ *How to fill the vector.
+ */
+
+ virtual void create() {
+
+ }
+
+ /**
+ *Assignment operator
+ *@param _vector The vector passed to the function determine the new content.
+ *@return a new vector.
+ */
+
+ virtual moCudaVector& operator=(const moCudaVector & _vector) {
+
+ N = _vector.N;
+ vect = new ElemType[N];
+ for (unsigned i = 0; i < N; i++)
+ vect[i] = _vector.vect[i];
+ fitness(_vector.fitness());
+ return (*this);
+
+ }
+
+ /**
+ *An accessor read only on the i'th element of the vector (function inline can be called from host or device).
+ *@param
+ *_i The i'th element of vector.
+ *@return
+ *The i'th element of the vector for read only
+ */
+
+ inline __host__ __device__ const ElemType & operator[](unsigned _i) const {
+
+ return vect[_i];
+
+ }
+
+ /**
+ *An accessor read-write on the i'th element of the vector(function inline can be called from host or device).
+ *@param _i The i'th element of the vector.
+ *@return The i'th element of the vector for read-write
+ */
+
+ inline __host__ __device__ ElemType & operator[](unsigned _i) {
+
+ return vect[_i];
+
+ }
+
+ /**
+ *Function inline to get the size of vector, called from host and device.
+ *@return The vector size's
+ */
+
+ inline __host__ __device__ unsigned size() {
+
+ return N;
+
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/eval/moCudaEval.h b/ParadisEO-GPU/src/eval/moCudaEval.h
new file mode 100644
index 000000000..35ae565fa
--- /dev/null
+++ b/ParadisEO-GPU/src/eval/moCudaEval.h
@@ -0,0 +1,128 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef moCudaEval_H
+#define moCudaEval_H
+#include
+
+/**
+ * Abstract class for evaluation on GPU
+ */
+template
+class moCudaEval: public moEval {
+
+public:
+
+ /**
+ * Define type of a solution corresponding to Neighbor
+ */
+ typedef typename Neighbor::EOT EOT;
+
+ typedef typename EOT::Fitness Fitness;
+
+ /**
+ * Constructor
+ * @param
+ * _neighborhoodSize the size of the neighborhood
+ */
+
+ moCudaEval(unsigned int _neighborhoodSize) {
+
+ neighborhoodSize = _neighborhoodSize;
+ host_FitnessArray = new Fitness[neighborhoodSize];
+ cudaMalloc((void**) &device_FitnessArray, neighborhoodSize
+ * sizeof(Fitness));
+ kernel_Dim=neighborhoodSize/BLOCK_SIZE+((neighborhoodSize%BLOCK_SIZE==0)?0:1);
+ }
+
+ /**
+ * Destructor
+ */
+
+ ~moCudaEval() {
+
+ delete[] host_FitnessArray;
+ cudaFree(device_FitnessArray);
+ cudaFree(&device_solution);
+ }
+
+ /**
+ * Set fitness of a solution neighbors
+ *@param _sol the solution which generate the neighborhood
+ *@param _neighbor the current neighbor
+ */
+
+ void operator()(EOT & _sol, Neighbor & _neighbor) {
+
+ _neighbor.fitness(host_FitnessArray[_neighbor.index()]);
+ /*std::cout << _sol.fitness() << " -host_FitnessArray["
+ << _neighbor.index() << "]= "
+ << host_FitnessArray[_neighbor.index()] << std::endl;*/
+
+ }
+
+ /**
+ * Compute fitness for all solution neighbors in device
+ * @param
+ * _sol the solution which generate the neighborhood
+ */
+ virtual void neighborhoodEval(EOT & _sol, unsigned * _mapping,
+ unsigned _Kswap) {
+
+ }
+
+ /**
+ * Compute fitness for all solution neighbors in device
+ * @param
+ * _sol the solution which generate the neighborhood
+ */
+
+ virtual void neighborhoodEval(EOT & _sol)=0;
+
+protected:
+
+ //the host array to save all neighbors fitness
+ Fitness * host_FitnessArray;
+ //the device array to save neighbors fitness computed in device
+ Fitness * device_FitnessArray;
+ //the device solution
+ EOT device_solution;
+ //the size of neighborhood
+ unsigned int neighborhoodSize;
+ //Cuda kernel dimension
+ int kernel_Dim;
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/eval/moCudaEvalFunc.h b/ParadisEO-GPU/src/eval/moCudaEvalFunc.h
new file mode 100644
index 000000000..a30ae3bec
--- /dev/null
+++ b/ParadisEO-GPU/src/eval/moCudaEvalFunc.h
@@ -0,0 +1,78 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef __moCudaEvalFunc_H
+#define __moCudaEvalFunc_H
+
+/**
+ * Abstract class for Incremental evaluation of neighbor
+ */
+
+template
+class moCudaEvalFunc {
+
+public:
+
+ /**
+ * Define type of a solution corresponding to Neighbor
+ */
+
+ typedef typename Neighbor::EOT EOT;
+ typedef typename EOT::Fitness Fitness;
+
+ /**
+ * Constructor
+ */
+
+ moCudaEvalFunc() {
+ }
+
+ /**
+ * Destructor
+ */
+
+ ~moCudaEvalFunc() {
+ }
+
+ /**
+ *Virtual functor to compute fitness of a solution neighbor
+ *@param _solution the solution which generate the neighborhood
+ *@param _fitness the current solution fitness
+ *@param _id the index neighbor
+ */
+
+ virtual inline __host__ __device__ Fitness operator() (EOT & _solution,Fitness _fitness, unsigned _id)=0;
+
+};
+#endif
diff --git a/ParadisEO-GPU/src/eval/moCudaKswapEval.h b/ParadisEO-GPU/src/eval/moCudaKswapEval.h
new file mode 100644
index 000000000..98d643922
--- /dev/null
+++ b/ParadisEO-GPU/src/eval/moCudaKswapEval.h
@@ -0,0 +1,121 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef moCudaKswapEval_H
+#define moCudaKswapEval_H
+#include
+#include
+
+/**
+ * class for the cuda evaluation
+ */
+
+template
+class moCudaKswapEval: public moCudaEval {
+
+public:
+
+ /**
+ * Define type of a solution corresponding to Neighbor
+ */
+ typedef typename Neighbor::EOT EOT;
+ /**
+ * Define type of a vector corresponding to Solution
+ */
+ typedef typename EOT::ElemType T;
+ /**
+ * Define type of a fitness corresponding to Solution
+ */
+ typedef typename EOT::Fitness Fitness;
+
+ using moCudaEval::neighborhoodSize;
+ using moCudaEval::host_FitnessArray;
+ using moCudaEval::device_FitnessArray;
+ using moCudaEval::device_solution;
+ using moCudaEval::kernel_Dim;
+
+ /**
+ * Constructor
+ * @param _neighborhoodSize the size of the neighborhood
+ * @param _incrEval the incremental evaluation
+ */
+
+ moCudaKswapEval(unsigned _neighborhoodSize, IncrementEval & _incrEval) :
+ moCudaEval (_neighborhoodSize), incrEval(_incrEval) {
+ }
+
+ /**
+ * Compute fitness for all solution neighbors in device
+ * @param _sol the solution which generate the neighborhood
+ */
+
+ virtual void neighborhoodEval(EOT & _sol) {
+ }
+
+ /**
+ * Compute fitness for all solution neighbors in device
+ * @param _sol the solution which generate the neighborhood
+ * @param _mapping the array of indices mapping
+ * @param _Kswap the number of swap
+ */
+
+ void neighborhoodEval(EOT & _sol, unsigned * _mapping, unsigned _Kswap) {
+
+ // the solution vector size
+ unsigned _size = _sol.size();
+
+ // Get Current solution fitness
+ Fitness fitness = _sol.fitness();
+
+ //Allocate the space for solution in the global memory of device
+ cudaMalloc((void**) &device_solution.vect, _size * sizeof(T));
+
+ //Copy the solution vector from the host to device
+ cudaMemcpy(device_solution.vect, _sol.vect, _size * sizeof(T),
+ cudaMemcpyHostToDevice);
+
+ //Launch the Kernel to compute all neighbors fitness
+ kernelKswap<<>>(incrEval,device_solution,device_FitnessArray,fitness,neighborhoodSize,_mapping,_Kswap);
+ //Copy the result from device to host
+ cudaMemcpy(host_FitnessArray, device_FitnessArray, neighborhoodSize
+ * sizeof(Fitness), cudaMemcpyDeviceToHost);
+ }
+
+protected:
+
+ IncrementEval & incrEval;
+};
+
+#endif
+
diff --git a/ParadisEO-GPU/src/eval/moCudaVectorEval.h b/ParadisEO-GPU/src/eval/moCudaVectorEval.h
new file mode 100644
index 000000000..920649fc6
--- /dev/null
+++ b/ParadisEO-GPU/src/eval/moCudaVectorEval.h
@@ -0,0 +1,113 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef moCudaVectorEval_H
+#define moCudavectorEval_H
+#include
+#include
+
+/**
+ * class for the cuda evaluation
+ */
+
+template
+class moCudaVectorEval: public moCudaEval {
+
+public:
+
+ /**
+ * Define type of a solution corresponding to Neighbor
+ */
+ typedef typename Neighbor::EOT EOT;
+ /**
+ * Define type of a vector corresponding to Solution
+ */
+ typedef typename EOT::ElemType T;
+ /**
+ * Define type of a fitness corresponding to Solution
+ */
+ typedef typename EOT::Fitness Fitness;
+
+ using moCudaEval::neighborhoodSize;
+ using moCudaEval::host_FitnessArray;
+ using moCudaEval::device_FitnessArray;
+ using moCudaEval::device_solution;
+ using moCudaEval::kernel_Dim;
+
+ /**
+ * Constructor
+ * @param _neighborhoodSize the size of the neighborhood
+ * @param _incrEval the incremental evaluation
+ */
+
+ moCudaVectorEval(unsigned _neighborhoodSize, IncrementEval & _incrEval) :
+ moCudaEval (_neighborhoodSize), incrEval(_incrEval) {
+ }
+ /**
+ * Compute fitness for all solution neighbors in device
+ * @param _sol the solution which generate the neighborhood
+ */
+
+ virtual void neighborhoodEval(EOT & _sol) {
+
+ // the solution vector size
+ unsigned _size = _sol.size();
+
+ // Get Current solution fitness
+ Fitness fitness = _sol.fitness();
+
+ //Allocate the space for solution in the global memory of device
+ cudaMalloc((void**) &device_solution.vect, _size * sizeof(T));
+
+ //Copy the solution vector from the host to device
+ cudaMemcpy(device_solution.vect, _sol.vect, _size * sizeof(T),
+ cudaMemcpyHostToDevice);
+
+ //Launch the Kernel to compute all neighbors fitness
+ kernelEval<<>>(incrEval,device_solution,device_FitnessArray,fitness,neighborhoodSize);
+
+ //Copy the result from device to host
+ cudaMemcpy(host_FitnessArray, device_FitnessArray, neighborhoodSize
+ * sizeof(Fitness), cudaMemcpyDeviceToHost);
+
+ }
+
+protected:
+
+ IncrementEval & incrEval;
+
+};
+
+#endif
+
diff --git a/ParadisEO-GPU/src/eval/moCudakernelEval.h b/ParadisEO-GPU/src/eval/moCudakernelEval.h
new file mode 100644
index 000000000..8326de632
--- /dev/null
+++ b/ParadisEO-GPU/src/eval/moCudakernelEval.h
@@ -0,0 +1,96 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+#ifndef __moCudakernelEval_H
+#define __moCudakernelEval_H
+
+/**
+ * The kernel function called from the host and executed in device to compute all neighbors fitness at one time
+ * @param _eval how to evaluate each neighbor
+ * @param _solution representation of one max problem solution
+ * @param _allFitness Array of Fitness type to save all neighbors fitness
+ * @param _fitness the current solution fitness
+ * @param _neighborhoodsize the size of the neighborhood
+ */
+
+template
+
+__global__ void kernelEval(IncrementEval _eval, EOT _solution, Fitness* _allFitness,
+ Fitness _fitness, unsigned _neighborhoodsize) {
+
+ // The thread identifier within a grid block's
+ int id = blockIdx.x * blockDim.x + threadIdx.x;
+
+ // In this representation each id identify one and only one neighbor in neighborhood
+ if (id < _neighborhoodsize) {
+
+ //Compute fitness for id'th neighbor
+
+ _allFitness[id] = _eval(_solution, _fitness, id);
+
+ }
+}
+
+/**
+ * The kernel function called from the host and executed in device to compute all neighbors fitness at one time
+ * @param _eval how to evaluate each neighbor
+ * @param _solution representation of one max problem solution
+ * @param _allFitness Array of Fitness type to save all neighbors fitness
+ * @param _fitness the current solution fitness
+ * @param _neighborhoodsize the size of the neighborhood
+ */
+
+template
+
+__global__ void kernelKswap(IncrementEval _eval, EOT _solution, Fitness* _allFitness,
+ Fitness _fitness, unsigned _neighborhoodsize, unsigned * _mapping,unsigned _Kswap) {
+
+ // The thread identifier within a grid block's
+ int id = blockIdx.x * blockDim.x + threadIdx.x;
+ unsigned tmp;
+ unsigned i;
+ unsigned index;
+ // In this representation each id identify one and only one neighbor in neighborhood
+ if (id < _neighborhoodsize) {
+ tmp=_fitness;
+ for(i=0;i<=_Kswap;i++){
+
+ index=_mapping[id + i * _neighborhoodsize];
+ tmp= _eval(_solution, tmp, index);
+ }
+ _allFitness[id]=tmp;
+
+}
+}
+
+#endif
diff --git a/ParadisEO-GPU/src/memory/moCudaAllocator.h b/ParadisEO-GPU/src/memory/moCudaAllocator.h
new file mode 100644
index 000000000..82f6aacd4
--- /dev/null
+++ b/ParadisEO-GPU/src/memory/moCudaAllocator.h
@@ -0,0 +1,82 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Boufaras Karima, Thé Van Luong
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaAllocator_H_
+#define _moCudaAllocator_H_
+
+// CUDA includes
+#include
+
+/**
+ * class for allocation data on GPU global memory
+ */
+
+template
+class moCudaAllocator {
+
+public:
+
+ /**
+ * Constructor
+ */
+
+ moCudaAllocator() {
+ }
+
+ /**
+ *Allocate data on GPU global memory
+ *@param _data the data to allocate on GPU global memory
+ *@param _dataSize the size of data to allocate on GPU memory
+ */
+
+ void operator()(T* & _data, unsigned _dataSize) {
+
+ //Allocate data in GPU memory
+ CUDA_SAFE_CALL(cudaMalloc((void**) &_data, _dataSize * sizeof(T)));
+
+ // Check if data allocation was successfuly done
+ CUT_CHECK_ERROR("Allocation of data on GPU global memory failed");
+
+ }
+
+ /**
+ * Destructor
+ */
+
+ ~moCudaAllocator() {
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/memory/moCudaCopy.h b/ParadisEO-GPU/src/memory/moCudaCopy.h
new file mode 100644
index 000000000..d39e05540
--- /dev/null
+++ b/ParadisEO-GPU/src/memory/moCudaCopy.h
@@ -0,0 +1,106 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Boufaras Karima, Thé Van Luong
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaCopy_H_
+#define _moCudaCopy_H_
+
+// CUDA includes
+#include
+
+/**
+ * class to copy data from CPU memory to GPU global memory and vice versa
+ */
+
+template
+class moCudaCopy {
+
+public:
+
+ /**
+ * Constructor
+ */
+
+ moCudaCopy() {
+ }
+
+ /**
+ *Copy data from CPU memory to GPU global memory (default copy)
+ *@param _data the data representation where the data will be copied
+ *@param _dataTocpy the data to copy from CPU memory to GPU memory
+ *@param _dataSize the size of data to copy
+ */
+
+ void operator()(T* & _data, T * _dataTocpy, unsigned _dataSize) {
+
+ //copy data from CPU memeory to GPU memory
+ CUDA_SAFE_CALL(cudaMemcpy(_data, _dataTocpy, _dataSize * sizeof(T),
+ cudaMemcpyHostToDevice));
+ // Check if data was successfuly copied
+ CUT_CHECK_ERROR("Copy of data from CPU to GPU global memory failed");
+
+ }
+
+ /**
+ *Copy data from CPU memory to GPU global memory and vice versa
+ *@param _data the data representation where the data will be copied
+ *@param _dataTocpy the data to copy from CPU memory to GPU memory and vice versa
+ *@param _dataSize the size of data to copy
+ *@param _HostToDevice the direction of copy(true if copy will be done from CPU memory to GPU memory)
+ */
+
+ void operator()(T* & _data, T * _dataTocpy, unsigned _dataSize,
+ bool _HostToDevice) {
+
+ if (_HostToDevice) {
+
+ //copy data from CPU memory to GPU memory
+ CUDA_SAFE_CALL(cudaMemcpy(_data, _dataTocpy, _dataSize * sizeof(T),
+ cudaMemcpyHostToDevice));
+ // Check if data was successfuly copied
+ CUT_CHECK_ERROR("Copy of data from CPU to GPU global memory failed");
+ } else {
+ cudaMemcpy(_data, _dataTocpy, _dataSize * sizeof(T),
+ cudaMemcpyDeviceToHost);
+ // Check if data was successfuly copied from GPU memory to CPU memory
+ CUT_CHECK_ERROR("Copy of data from GPU global memory to CPU failed");
+
+ }
+ }
+
+ ~moCudaCopy() {
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/memory/moCudaDesallocator.h b/ParadisEO-GPU/src/memory/moCudaDesallocator.h
new file mode 100644
index 000000000..0935daea7
--- /dev/null
+++ b/ParadisEO-GPU/src/memory/moCudaDesallocator.h
@@ -0,0 +1,82 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Boufaras Karima, Thé Van Luong
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaDesallocator_H_
+#define _moCudaDesallocator_H_
+
+// CUDA includes
+#include
+
+/**
+ * class for allocation data on GPU global memory
+ */
+
+template
+class moCudaDesallocator {
+
+public:
+
+ /**
+ * Constructor
+ */
+
+ moCudaDesallocator() {
+ }
+
+ /**
+ *Desallocate data on GPU global memory
+ *@param _data the data to allocate on GPU global memory
+ *@param _dataSize the size of data to allocate on GPU memory
+ */
+
+ void operator()(T* & _data) {
+
+ //Allocate data in GPU memory
+ CUDA_SAFE_CALL(cudaFree(_data));
+
+ // Check if data allocation was successfuly done
+ CUT_CHECK_ERROR("Desallocation of data on GPU global memory failed");
+
+ }
+
+ /**
+ * Destructor
+ */
+
+ ~moCudaDesallocator() {
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/neighborhood/moCudaBitFlippingNeighbor.h b/ParadisEO-GPU/src/neighborhood/moCudaBitFlippingNeighbor.h
new file mode 100644
index 000000000..35bac161f
--- /dev/null
+++ b/ParadisEO-GPU/src/neighborhood/moCudaBitFlippingNeighbor.h
@@ -0,0 +1,106 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Boufaras Karima, Thé Van Luong
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can ue,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaBitFlippingNeighbor_h
+#define _moCudaBitFlippingNeighbor_h
+
+#include
+
+/**
+ * Inversion of N bits
+ */
+
+template
+class moCudaBitFlippingNeighbor: public moCudaKswapNeighbor {
+
+ using moCudaKswapNeighbor::indices;
+ using moCudaKswapNeighbor::Kswap;
+ using moCudaKswapNeighbor::size;
+
+public:
+
+ /**
+ *Default Constructor
+ */
+
+ moCudaBitFlippingNeighbor() :
+ moCudaKswapNeighbor() {
+
+ }
+
+ /**
+ * Constructor
+ * @param _Kflip the number of bit to flip
+ */
+
+ moCudaBitFlippingNeighbor(unsigned int _Kflip) :
+ moCudaKswapNeighbor(_Kflip) {
+
+ }
+
+ /**
+ * Apply the K-Flip in solution
+ * @param _solution the solution to move
+ */
+ virtual void move(EOT& _solution) {
+ size = _solution.size();
+ if (!Kswap) {
+ _solution[indices[Kswap]] = !_solution[indices[Kswap]];
+ } else {
+ for (unsigned int i = 0; i <= Kswap; i++) {
+ _solution[indices[i]] = !_solution[indices[i]];
+ std::cout << "indices[" << i << "]= " << indices[i]
+ << std::endl;
+ }
+ }
+
+ _solution.invalidate();
+
+ }
+
+ /**
+ * apply the K-Flip to restore the solution (use by moFullEvalByModif)
+ * @param _solution the solution to move back
+ */
+ virtual void moveBack(EOT& _solution) {
+ move(_solution);
+ }
+
+ /**
+ * Return the class name.
+ * @return the class name as a std::string
+ */
+ virtual std::string className() const {
+ return "moCudaBitFlippingNeighbor";
+ }
+
+};
+
+#endif
+
diff --git a/ParadisEO-GPU/src/neighborhood/moCudaBitNeighbor.h b/ParadisEO-GPU/src/neighborhood/moCudaBitNeighbor.h
new file mode 100644
index 000000000..7a7549375
--- /dev/null
+++ b/ParadisEO-GPU/src/neighborhood/moCudaBitNeighbor.h
@@ -0,0 +1,121 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Jerémie Humeau, Boufaras Karima, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaBitNeighbor_h
+#define _moCudaBitNeighbor_h
+
+#include
+#include
+
+/**
+ * Neighbor related to a solution vector of EOT (type)
+ */
+
+template
+class moCudaBitNeighbor: public moBackableNeighbor ,
+ public moIndexNeighbor {
+
+public:
+
+ using moBackableNeighbor::fitness;
+ using moIndexNeighbor::key;
+
+ /**
+ * move the solution
+ * @param
+ * _solution the solution to move
+ */
+
+ virtual void move(EOT & _solution) {
+
+ _solution[key] = !_solution[key];
+
+ }
+
+ /**
+ * move back the solution (useful for the evaluation by modif)
+ * @param
+ * _solution the solution to move back
+ */
+
+ virtual void moveBack(EOT & _solution) {
+
+ _solution[key] = !_solution[key];
+
+ }
+
+ /**
+ * Return the class name.
+ * @return the class name as a std::string
+ */
+ virtual std::string className() const {
+ return "moCudaBitNeighbor";
+ }
+
+ /**
+ * Read object.\
+ * Calls base class, just in case that one had something to do.
+ * The read and print methods should be compatible and have the same format.
+ * In principle, format is "plain": they just print a number
+ * @param _is a std::istream.
+ * @throw runtime_std::exception If a valid object can't be read.
+ */
+
+ virtual void readFrom(std::istream& _is) {
+ std::string fitness_str;
+ int pos = _is.tellg();
+ _is >> fitness_str;
+ if (fitness_str == "INVALID") {
+ throw std::runtime_error("invalid fitness");
+ } else {
+ Fitness repFit;
+ _is.seekg(pos);
+ _is >> repFit;
+ _is >> key;
+ fitness(repFit);
+ }
+ }
+
+ /**
+ * Write object. Called printOn since it prints the object _on_ a stream.
+ * @param _os A std::ostream.
+ */
+
+ virtual void printOn(std::ostream& _os) const {
+ _os << fitness() << ' ' << key << std::endl;
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/neighborhood/moCudaKswapNeighborhood.h b/ParadisEO-GPU/src/neighborhood/moCudaKswapNeighborhood.h
new file mode 100644
index 000000000..170992607
--- /dev/null
+++ b/ParadisEO-GPU/src/neighborhood/moCudaKswapNeighborhood.h
@@ -0,0 +1,115 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Boufaras Karima, Thé Van Luong
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can ue,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaKswapNeighborhood_h
+#define _moCudaKswapNeighborhood_h
+
+#include
+#include
+
+/**
+ * K-Swap Neighborhood
+ */
+template
+class moCudaKswapNeighborhood: public moKswapNeighborhood {
+
+public:
+
+ typedef N Neighbor;
+ typedef typename Neighbor::EOT EOT;
+
+ using moKswapNeighborhood::neighborhoodSize;
+ using moKswapNeighborhood::currentIndex;
+ using moKswapNeighborhood::indices;
+ using moKswapNeighborhood::mapping;
+ using moKswapNeighborhood::Kswap;
+ using moKswapNeighborhood::size;
+ using moKswapNeighborhood::mutex;
+
+ /**
+ * Constructor
+ * @param _size the size of solution
+ * @param _size the solution size
+ * @param _Kswap the number of swap
+ * @param _eval show how to evaluate neighborhood of a solution at one time
+ */
+
+ moCudaKswapNeighborhood(unsigned int _size, unsigned int _Kswap,
+ moCudaEval& _eval) :
+ moKswapNeighborhood (_size, _Kswap), eval(_eval) {
+ sendMapping = true;
+ cudaMalloc((void**) &device_Mapping, sizeof(unsigned int)
+ * neighborhoodSize * (Kswap + 1));
+ }
+ ;
+
+ /**
+ *Destructor
+ */
+
+ ~moCudaKswapNeighborhood() {
+
+ cudaFree(device_Mapping);
+ }
+
+ /**
+ * Initialization of the neighborhood
+ * @param _solution the solution to explore
+ * @param _current the first neighbor
+ */
+
+ virtual void init(EOT& _solution, Neighbor& _current) {
+
+ moKswapNeighborhood::init(_solution, _current);
+ if (sendMapping) {
+ cudaMemcpy(device_Mapping, mapping, (Kswap + 1) * neighborhoodSize * sizeof(unsigned int),
+ cudaMemcpyHostToDevice);
+ sendMapping = false;
+ }
+ //Compute all neighbors fitness at one time
+ eval.neighborhoodEval(_solution, device_Mapping, Kswap);
+ }
+
+ /**
+ * Return the class Name
+ * @return the class name as a std::string
+ */
+ virtual std::string className() const {
+ return "moCudaKSwapNeighborhood";
+ }
+
+protected:
+
+ moCudaEval& eval;
+ bool sendMapping;
+ unsigned int * device_Mapping;
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/neighborhood/moCudaOrderNeighborhood.h b/ParadisEO-GPU/src/neighborhood/moCudaOrderNeighborhood.h
new file mode 100644
index 000000000..bf9e2f8cf
--- /dev/null
+++ b/ParadisEO-GPU/src/neighborhood/moCudaOrderNeighborhood.h
@@ -0,0 +1,96 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Jerémie Humeau, Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaOrderNeighborhood_h
+#define _moCudaOrderNeighborhood_h
+
+#include
+#include
+
+/**
+ * An ordered neighborhood with parallel evaluation
+ */
+
+template
+class moCudaOrderNeighborhood: public moOrderNeighborhood {
+
+public:
+
+ /**
+ * Define type of a solution corresponding to Neighbor
+ */
+
+ typedef N Neighbor;
+ typedef typename Neighbor::EOT EOT;
+
+ using moOrderNeighborhood::neighborhoodSize;
+ using moOrderNeighborhood::currentIndex;
+
+ /**
+ * Constructor
+ * @param _neighborhoodSize the size of the neighborhood
+ * @param _eval show how to evaluate neighborhood of a solution at one time
+ */
+
+ moCudaOrderNeighborhood(unsigned int _neighborhoodSize,
+ moCudaEval& _eval) :
+ moOrderNeighborhood (_neighborhoodSize), eval(_eval) {
+ }
+
+ /**
+ * Initialization of the neighborhood
+ *@param _solution the solution to explore
+ *@param _neighbor the first neighbor
+ */
+
+ virtual void init(EOT & _solution, Neighbor & _neighbor) {
+
+ moOrderNeighborhood::init(_solution, _neighbor);
+ //Compute all neighbors fitness at one time
+ eval.neighborhoodEval(_solution);
+ }
+
+ /**
+ * Return the class name.
+ * @return the class name as a std::string
+ */
+ virtual std::string className() const {
+ return "moCudaOrderNeighborhood";
+ }
+
+protected:
+ moCudaEval& eval;
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/neighborhood/moCudaRndWithReplNeighborhood.h b/ParadisEO-GPU/src/neighborhood/moCudaRndWithReplNeighborhood.h
new file mode 100644
index 000000000..65cbe44f7
--- /dev/null
+++ b/ParadisEO-GPU/src/neighborhood/moCudaRndWithReplNeighborhood.h
@@ -0,0 +1,88 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Jerémie Humeau, Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaRndWithReplNeighborhood_h
+#define _moCudaRndWithReplNeighborhood_h
+
+#include
+#include
+
+/**
+ * A Random With replacement Neighborhood with parallel evaluation
+ */
+template
+class moCudaRndWithReplNeighborhood: public moRndWithReplNeighborhood {
+public:
+
+ /**
+ * Define type of a solution corresponding to Neighbor
+ */
+ typedef typename Neighbor::EOT EOT;
+
+ using moRndWithReplNeighborhood::neighborhoodSize;
+
+ /**
+ * Constructor
+ * @param _neighborhoodSize the size of the neighborhood
+ * @param _eval show how to evaluate neighborhood of a solution at one time
+ */
+ moCudaRndWithReplNeighborhood(unsigned int _neighborhoodSize, moCudaEval<
+ Neighbor>& _eval) :
+ moRndWithReplNeighborhood (_neighborhoodSize), eval(_eval) {
+ }
+
+ /**
+ * Initialization of the neighborhood
+ * @param _solution the solution to explore
+ * @param _neighbor the first neighbor
+ */
+ virtual void init(EOT & _solution, Neighbor & _neighbor) {
+ moRndWithReplNeighborhood::init(_solution, _neighbor);
+ //Compute all neighbors fitness at one time
+ eval.neighborhoodEval(_solution);
+
+ }
+
+ /**
+ * Return the class Name
+ * @return the class name as a std::string
+ */
+ virtual std::string className() const {
+ return "moCudaRndWithReplNeighborhood";
+ }
+protected:
+ moCudaEval& eval;
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/neighborhood/moCudaRndWithoutReplNeighborhood.h b/ParadisEO-GPU/src/neighborhood/moCudaRndWithoutReplNeighborhood.h
new file mode 100644
index 000000000..a7b9b5b90
--- /dev/null
+++ b/ParadisEO-GPU/src/neighborhood/moCudaRndWithoutReplNeighborhood.h
@@ -0,0 +1,90 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Jerémie Humeau, Boufaras Karima, Thé Van LUONG
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaRndWithoutReplNeighborhood_h
+#define _moCudaRndWithoutReplNeighborhood_h
+
+#include
+#include
+
+/**
+ * A Random without replacement Neighborhood with parallel evaluation
+ */
+template
+class moCudaRndWithoutReplNeighborhood: public moRndWithoutReplNeighborhood {
+public:
+
+ /**
+ * Define type of a solution corresponding to Neighbor
+ */
+ typedef typename Neighbor::EOT EOT;
+
+ using moRndWithoutReplNeighborhood::neighborhoodSize;
+ using moRndWithoutReplNeighborhood::maxIndex;
+ using moRndWithoutReplNeighborhood::indexVector;
+ /**
+ * Constructor
+ * @param _neighborhoodSize the size of the neighborhood
+ * @param _eval show how to evaluate neighborhood of a solution at one time
+ */
+ moCudaRndWithoutReplNeighborhood(unsigned int _neighborhoodSize,moCudaEval<
+ Neighbor>& _eval) :
+ moRndWithoutReplNeighborhood (_neighborhoodSize),eval(_eval) {
+ for (unsigned int i = 0; i < neighborhoodSize; i++)
+ indexVector.push_back(i);
+ }
+
+ /**
+ * Initialization of the neighborhood
+ * @param _solution the solution to explore
+ * @param _neighbor the first neighbor
+ */
+ virtual void init(EOT & _solution, Neighbor & _neighbor) {
+ moRndWithoutReplNeighborhood::init(_solution, _neighbor);
+ //Compute all neighbors fitness at one time
+ eval.neighborhoodEval(_solution);
+ }
+
+ /**
+ * Return the class Name
+ * @return the class name as a std::string
+ */
+ virtual std::string className() const {
+ return "moCudaRndWithoutReplNeighborhood";
+ }
+
+protected:
+ moCudaEval& eval;
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/performance/moCudaTimer.h b/ParadisEO-GPU/src/performance/moCudaTimer.h
new file mode 100644
index 000000000..82e13e44b
--- /dev/null
+++ b/ParadisEO-GPU/src/performance/moCudaTimer.h
@@ -0,0 +1,116 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef _moCudaTimer_H_
+#define _moCudaTimer_H_
+
+// CUDA Utility Tools
+#include
+
+/**
+ * To compute execution time
+ */
+
+class moCudaTimer {
+
+public:
+
+ unsigned int timer;
+
+ /**
+ * Constructor
+ */
+
+ moCudaTimer() {
+
+ timer = 0;
+ //Create timer
+ cutCreateTimer(&timer);
+ }
+
+ /**
+ * Destructor
+ */
+
+ ~moCudaTimer() {
+
+ }
+
+ /**
+ * to start compute execution time
+ */
+
+ void start() {
+
+ // Start timer
+ cutStartTimer(timer);
+ }
+
+ /**
+ * to stop compute execution time
+ */
+
+ void stop() {
+
+ // Stop timer
+ cutStopTimer(timer);
+
+ }
+
+ /**
+ * to get timer value in ms
+ * @return execution time in ms
+ */
+
+ double getTime() {
+
+ // get time
+ return cutGetTimerValue(timer);
+
+ }
+
+ /**
+ * to delete timer
+ */
+
+ void deleteTimer() {
+
+ //Delete timer
+ cutDeleteTimer(timer);
+
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/problems/eval/EvalOneMax.h b/ParadisEO-GPU/src/problems/eval/EvalOneMax.h
new file mode 100644
index 000000000..b6a740398
--- /dev/null
+++ b/ParadisEO-GPU/src/problems/eval/EvalOneMax.h
@@ -0,0 +1,79 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef __EvalOneMax
+#define __EvalOneMax
+
+/**
+ * Full Evaluation of the solution
+ */
+
+template
+class EvalOneMax: public eoEvalFunc {
+
+public:
+
+ /**
+ * Constructor
+ */
+
+ EvalOneMax() {
+ }
+
+ /**
+ * Destructor
+ */
+
+ ~EvalOneMax(void) {
+ }
+
+ /**
+ * Full evaluation of the solution
+ * @param _bitVector the solution to evaluate
+ */
+
+ void operator()(EOT & _bitVector) {
+
+ unsigned sum = 0;
+
+ for (unsigned i = 0; i < _bitVector.size(); i++)
+ sum += _bitVector[i];
+
+ //set the solution fitness
+ _bitVector.fitness(sum);
+ }
+
+};
+
+#endif
diff --git a/ParadisEO-GPU/src/problems/eval/OneMaxIncrEval.h b/ParadisEO-GPU/src/problems/eval/OneMaxIncrEval.h
new file mode 100644
index 000000000..d338f7e09
--- /dev/null
+++ b/ParadisEO-GPU/src/problems/eval/OneMaxIncrEval.h
@@ -0,0 +1,90 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+#ifndef __OneMaxIncrEval_H
+#define __OneMaxIncrEval_H
+
+#include
+
+/**
+ * Incremental Evaluation of OneMax
+ */
+
+template
+class OneMaxIncrEval: public moCudaEvalFunc {
+
+public:
+
+ typedef typename Neighbor::EOT EOT;
+ typedef typename EOT::Fitness Fitness;
+
+ /**
+ * Constructor
+ */
+
+ OneMaxIncrEval() {
+ }
+
+ /**
+ * Destructor
+ */
+
+ ~OneMaxIncrEval() {
+ }
+
+ /**
+ * Incremental evaluation of the solution(function inline can be called from host or device)
+ * @param _bitVector the solution to evaluate
+ * @param _fitness the fitness of the current solution
+ * @param _id the index of solution neighbor
+ */
+
+ inline __host__ __device__ Fitness operator() (EOT & _bitVector,Fitness _fitness, unsigned _id) {
+
+ Fitness tmp;
+
+ if (_bitVector[_id] == 0)
+
+ tmp= _fitness+1;
+
+ else
+
+ tmp= _fitness-1;
+
+ return tmp;
+
+ }
+};
+
+#endif
diff --git a/ParadisEO-GPU/test/CMakeLists.txt b/ParadisEO-GPU/test/CMakeLists.txt
new file mode 100644
index 000000000..04a25733f
--- /dev/null
+++ b/ParadisEO-GPU/test/CMakeLists.txt
@@ -0,0 +1,73 @@
+###############################################################################
+##
+## CMakeLists file for OneMax Example/test
+##
+###############################################################################
+
+
+######################################################################################
+### 1) Include the sources
+######################################################################################
+
+INCLUDE_DIRECTORIES(
+
# include CUDA source directory
+ ${CUDA_SRC_DIR}
+ # include NVIDIA source directory
+ ${NVIDIA_SRC_DIR}
+ # include EO source directory
+ ${PARADISEO_EO_SRC_DIR}/src
+ # include MO source directory
+ ${PARADISEO_MO_SRC_DIR}/src
+ # include problems directory
+ ${PARADISEO_PROBLEMS_SRC_DIR}
+ # include GPU directory
+ ${PARADISEO_GPU_SRC_DIR}
+ # include your source directory
+ ${CMAKE_CURRENT_SOURCE_DIR}/../src
+ )
+
+######################################################################################
+### 2) Specify where CMake can find the libraries
+######################################################################################
+
+LINK_DIRECTORIES(${PARADISEO_EO_BIN_DIR}/lib ${NVIDIA_LIB_DIR} ${CUDA_LIB_DIR} )
+
+
+######################################################################################
+
+######################################################################################
+### 3) Define your targets and link the librairies
+######################################################################################
+
+SET (TEST_LIST
+ t-memory
+ t-moCudaBitVector
+ t-moCudaIntVector
+ t-moCudaBitNeighbor
+ t-OneMaxIncrEval
+ t-EvalOneMax
+ # t-moCudaKswapNeighborhood
+ )
+
+FOREACH (test ${TEST_LIST})
+ SET ("T_${test}_SOURCES" "${test}.cu")
+ENDFOREACH (test)
+
+
+IF(ENABLE_CMAKE_TESTING)
+
+ # Add the tests
+ FOREACH (test ${TEST_LIST})
+ CUDA_ADD_EXECUTABLE(${test} ${T_${test}_SOURCES})
+ ADD_TEST(${test} ${test})
+ ENDFOREACH (test)
+
+ # Link the librairies
+ FOREACH (test ${TEST_LIST})
+ TARGET_LINK_LIBRARIES(${test} ga es eoutils eo)
+ ENDFOREACH (test)
+
+ENDIF(ENABLE_CMAKE_TESTING)
+
+######################################################################################
+
diff --git a/ParadisEO-GPU/test/t-EvalOneMax.cu b/ParadisEO-GPU/test/t-EvalOneMax.cu
new file mode 100644
index 000000000..fab95a62a
--- /dev/null
+++ b/ParadisEO-GPU/test/t-EvalOneMax.cu
@@ -0,0 +1,67 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+*/
+
+#include
+#include
+#include
+#include
+#include
+
+typedef moCudaBitVector Solution;
+
+int main() {
+
+
+ std::cout << "[t-EvalOneMax] => START" << std::endl;
+
+
+ Solution sol(5);
+ EvalOneMax eval;
+ int sum=0;
+
+ eval(sol);
+ for(int i=0;i<5;i++){
+ sum+=sol[i];
+ sol[i]=0;
+ }
+
+ assert((int)(sol.fitness())==sum);
+
+ eval(sol);
+ assert((int)(sol.fitness())==0);
+
+ std::cout << "[t-EvalOneMax] => OK" << std::endl;
+
+ return EXIT_SUCCESS;
+}
diff --git a/ParadisEO-GPU/test/t-OneMaxIncrEval.cu b/ParadisEO-GPU/test/t-OneMaxIncrEval.cu
new file mode 100644
index 000000000..a10552404
--- /dev/null
+++ b/ParadisEO-GPU/test/t-OneMaxIncrEval.cu
@@ -0,0 +1,84 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Karima Boufaras, Thé Van LUONG
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+typedef moCudaBitVector Solution;
+typedef moCudaBitNeighbor Neighbor;
+
+int main() {
+
+
+ std::cout << "[t-OneMaxIncrEval] => START" << std::endl;
+
+
+ Solution sol(5);
+ EvalOneMax eval;
+ OneMaxIncrEval incr_eval;
+ int sum=0;
+ int fitness=0;
+
+ eval(sol);
+ for(int i=0;i<5;i++){
+ sum+=sol[i];
+ sol[i]=0;
+ }
+
+ assert((int)(sol.fitness())==sum);
+ eval(sol);
+ assert((int)(sol.fitness())==0);
+
+
+ fitness=incr_eval(sol,fitness,0);
+ sol[0]=1;
+ eval(sol);
+ assert((int)(sol.fitness())==1);
+
+ fitness=incr_eval(sol,fitness,0);
+ sol[0]=0;
+ eval(sol);
+ assert((int)(sol.fitness())==0);
+
+ std::cout << "[t-OneMaxIncrEval] => OK" << std::endl;
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/ParadisEO-GPU/test/t-memory.cu b/ParadisEO-GPU/test/t-memory.cu
new file mode 100644
index 000000000..e59a0a0e7
--- /dev/null
+++ b/ParadisEO-GPU/test/t-memory.cu
@@ -0,0 +1,91 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+int main() {
+
+
+ std::cout << "[t-memory] => START" << std::endl;
+
+ //test constructor
+ int * h_data;
+ int * cpy_data;
+ int * d_data;
+ moCudaAllocator alloc;
+ moCudaDesallocator desalloc;
+ moCudaCopy cpy;
+ int i=0;
+
+ //data allocation
+ h_data= new int[5];
+ cpy_data= new int[5];
+ alloc(d_data,5);
+
+ for(i=0;i<5;i++)
+ h_data[i]=i;
+
+ //test default way of copy from host to device
+ cpy(d_data,h_data,5);
+
+ //test copy from device to host
+ cpy(cpy_data,d_data,5,0);
+ i=0;
+ for(i=0;i<5;i++)
+ assert(cpy_data[i]==i);
+
+ for(i=0;i<5;i++)
+ h_data[i]=i*2;
+
+ //test copy from host to device
+ cpy(d_data,h_data,5,1);
+
+ //test copy from device to host
+ cpy(cpy_data,d_data,5,0);
+ i=0;
+ for(i=0;i<5;i++)
+ assert(cpy_data[i]==i*2);
+ desalloc(d_data);
+ std::cout << "[t-memory] => OK" << std::endl;
+
+ return EXIT_SUCCESS;
+}
+
+
diff --git a/ParadisEO-GPU/test/t-moCudaBitNeighbor.cu b/ParadisEO-GPU/test/t-moCudaBitNeighbor.cu
new file mode 100644
index 000000000..32b21854b
--- /dev/null
+++ b/ParadisEO-GPU/test/t-moCudaBitNeighbor.cu
@@ -0,0 +1,71 @@
+ /*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+ */
+
+ #include
+ #include
+ #include
+ #include
+ #include
+
+ typedef moCudaBitVector Solution;
+ typedef moCudaBitNeighbor Neighbor;
+
+
+ int main() {
+
+
+ std::cout << "[t-moCudaBitNeighbor] => START" << std::endl;
+ //test constructor
+ Neighbor test1, test2;
+
+ test1.fitness(3);
+ //test operateur d'affectation
+ test2=test1;
+ assert(test1.fitness()==test2.fitness());
+
+ //test operateur de copy
+ Neighbor test3(test1);
+ assert(test1.fitness()==test3.fitness());
+
+ test1.printOn(std::cout);
+ test2.printOn(std::cout);
+ test3.printOn(std::cout);
+
+ assert(test1.className()=="moCudaBitNeighbor");
+
+ std::cout << "[t-moCudaBitNeighbor] => OK" << std::endl;
+
+ return EXIT_SUCCESS;
+ }
+
diff --git a/ParadisEO-GPU/test/t-moCudaBitVector.cu b/ParadisEO-GPU/test/t-moCudaBitVector.cu
new file mode 100644
index 000000000..3ff8d9fe1
--- /dev/null
+++ b/ParadisEO-GPU/test/t-moCudaBitVector.cu
@@ -0,0 +1,94 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+typedef moCudaBitVector Solution;
+
+
+int main() {
+
+
+ std::cout << "[t-moCudaBitVector] => START" << std::endl;
+
+ EvalOneMax eval;
+ //verif default constructor
+ Solution sol;
+ assert(sol.size()==1);
+ //verif constructor of random vector
+ Solution sol1(5);
+ assert(sol1.size()==5);
+
+ //verif bool
+ for(int i=0;i<5;i++)
+ assert((sol1[i]==0)||(sol1[i]==1));
+
+ //test oneMax eval function
+ eval(sol1);
+ eoMaximizingFitness sum=0;
+ for(int i=0;i<5;i++)
+ sum=sol1[i]+sum;
+ assert(sol1.fitness()==sum);
+
+ //verif constructor of constant vector
+ Solution sol2(4,1);
+ assert(sol2.size()==4);
+ for(int i=0;i<4;i++)
+ assert(sol2[i]==1);
+ eval(sol2);
+ assert(sol2.fitness()==4);
+
+ //verif accessor
+ sol2[3]=0;
+ assert(sol2[3]==0);
+ eval(sol2);
+ assert(sol2.fitness()==3);
+
+ //verif operator =
+ sol2=sol1;
+ assert(sol1.size()==sol2.size());
+ assert(sol1.fitness()==sol2.fitness());
+ for(int i=0;i<5;i++)
+ assert(sol1[i]==sol2[i]);
+
+ std::cout << "[t-moCudaBitVector] => OK" << std::endl;
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/ParadisEO-GPU/test/t-moCudaIntVector.cu b/ParadisEO-GPU/test/t-moCudaIntVector.cu
new file mode 100644
index 000000000..c74446e59
--- /dev/null
+++ b/ParadisEO-GPU/test/t-moCudaIntVector.cu
@@ -0,0 +1,70 @@
+/*
+
+ Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
+
+ Thé Van LUONG, Karima Boufaras
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+ ParadisEO WebSite : http://paradiseo.gforge.inria.fr
+ Contact: paradiseo-help@lists.gforge.inria.fr
+*/
+
+#include
+#include
+#include
+#include
+#include
+
+typedef moCudaIntVector Solution;
+
+
+int main() {
+
+
+ std::cout << "[t-moCudaIntVector] => START" << std::endl;
+
+ //verif constructor
+ Solution sol;
+ Solution sol1(5);
+ Solution sol2(3);
+
+ assert(sol.size()==1);
+ assert(sol1.size()==5);
+ assert(sol2.size()==3);
+
+ //verif discret vector
+ for(int i=0;i<5;i++)
+ assert((sol1[i]>=0)||(sol1[i]<5));
+
+ //verif discret vector
+ for(int i=0;i<3;i++)
+ assert((sol2[i]>=0)||(sol2[i]<3));
+
+ std::cout << "[t-moCudaIntVector] => OK" << std::endl;
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/ParadisEO-GPU/tutoriel/CMakeLists.txt b/ParadisEO-GPU/tutoriel/CMakeLists.txt
new file mode 100644
index 000000000..13ce75b3c
--- /dev/null
+++ b/ParadisEO-GPU/tutoriel/CMakeLists.txt
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY(OneMax)
diff --git a/ParadisEO-GPU/tutoriel/OneMax/CMakeLists.txt b/ParadisEO-GPU/tutoriel/OneMax/CMakeLists.txt
new file mode 100644
index 000000000..0c8ea6ed2
--- /dev/null
+++ b/ParadisEO-GPU/tutoriel/OneMax/CMakeLists.txt
@@ -0,0 +1,60 @@
+###############################################################################
+##
+## CMakeLists file for OneMax Example/application
+##
+###############################################################################
+
+
+######################################################################################
+### 1) Include the sources
+######################################################################################
+
+INCLUDE_DIRECTORIES(
+
# include CUDA source directory
+ ${CUDA_SRC_DIR}
+ # include NVIDIA source directory
+ ${NVIDIA_SRC_DIR}
+ # include EO source directory
+ ${PARADISEO_EO_SRC_DIR}/src
+ # include MO source directory
+ ${PARADISEO_MO_SRC_DIR}/src
+ # include problems directory
+ ${PARADISEO_PROBLEMS_SRC_DIR}
+ # include GPU directory
+ ${PARADISEO_GPU_SRC_DIR}
+ # include your source directory
+ ${CMAKE_CURRENT_SOURCE_DIR}/../src
+ )
+
+######################################################################################
+
+######################################################################################
+### 2) Specify where CMake can find the libraries
+######################################################################################
+
+LINK_DIRECTORIES(${PARADISEO_EO_BIN_DIR}/lib ${NVIDIA_LIB_DIR} ${CUDA_LIB_DIR} )
+
+######################################################################################
+
+######################################################################################
+### 3) Define your targets and link the librairies
+######################################################################################
+
+#CUDA_ADD_EXECUTABLE(Cutest test.cu)
+CUDA_ADD_EXECUTABLE(CutestFirstImpr testFirstImpr.cu)
+CUDA_ADD_EXECUTABLE(CutestNeutralHC testNeutralHC.cu)
+CUDA_ADD_EXECUTABLE(CutestSimpleHC testSimpleHC.cu)
+CUDA_ADD_EXECUTABLE(CutestSimpleTS testSimpleTS.cu)
+CUDA_ADD_EXECUTABLE(CutestSimulatedAnnealing testSimulatedAnnealing.cu)
+CUDA_ADD_EXECUTABLE(CutestKswapHC testKswapHC.cu)
+
+#TARGET_LINK_LIBRARIES(Cutest eoutils ga eo libcutil.a)
+TARGET_LINK_LIBRARIES(CutestFirstImpr eoutils ga eo libcutil.a)
+TARGET_LINK_LIBRARIES(CutestNeutralHC eoutils ga eo libcutil.a)
+TARGET_LINK_LIBRARIES(CutestSimpleHC eoutils ga eo libcutil.a)
+TARGET_LINK_LIBRARIES(CutestSimpleTS eoutils ga eo libcutil.a)
+TARGET_LINK_LIBRARIES(CutestSimulatedAnnealing eoutils ga eo libcutil.a)
+TARGET_LINK_LIBRARIES(CutestKswapHC eoutils ga eo libcutil.a)
+
+
+######################################################################################
diff --git a/ParadisEO-GPU/tutoriel/OneMax/testFirstImpr.cu b/ParadisEO-GPU/tutoriel/OneMax/testFirstImpr.cu
new file mode 100644
index 000000000..09f7d851f
--- /dev/null
+++ b/ParadisEO-GPU/tutoriel/OneMax/testFirstImpr.cu
@@ -0,0 +1,222 @@
+//Init the number of threads per block
+#define BLOCK_SIZE 128
+
+#include
+#include
+using namespace std;
+
+// The general include for eo
+#include
+#include
+// Fitness function
+#include
+// Cuda Fitness function
+#include
+#include
+// One Max solution
+#include
+//To compute execution time
+#include
+// One Max neighbor
+#include
+// One Max ordered neighborhood
+#include
+// The Solution and neighbor comparator
+#include
+#include
+// The continuator
+#include
+// Local search algorithm
+#include
+// First improvment algorithm
+#include
+// The First Improvment algorithm explorer
+#include
+
+// REPRESENTATION
+typedef moCudaBitVector solution;
+typedef moCudaBitNeighbor Neighbor;
+typedef moCudaOrderNeighborhood Neighborhood;
+
+void main_function(int argc, char **argv)
+{
+ /* =========================================================
+ *
+ * Parameters
+ *
+ * ========================================================= */
+
+ // First define a parser from the command-line arguments
+ eoParser parser(argc, argv);
+
+ // For each parameter, define Parameter, read it through the parser,
+ // and assign the value to the variable
+
+ // seed
+ eoValueParam seedParam(time(0), "seed", "Random number seed", 'S');
+ parser.processParam( seedParam );
+ unsigned seed = seedParam.value();
+
+ // description of genotype
+ eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V');
+ parser.processParam( vecSizeParam, "Representation" );
+ unsigned vecSize = vecSizeParam.value();
+
+ // the name of the "status" file where all actual parameter values will be saved
+ string str_status = parser.ProgramName() + ".status"; // default value
+ eoValueParam statusParam(str_status.c_str(), "status", "Status file");
+ parser.processParam( statusParam, "Persistence" );
+
+ // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
+ // i.e. in case you need parameters somewhere else, postpone these
+ if (parser.userNeedsHelp()) {
+ parser.printHelp(cout);
+ exit(1);
+ }
+ if (statusParam.value() != "") {
+ ofstream os(statusParam.value().c_str());
+ os << parser;// and you can use that file as parameter file
+ }
+
+ /* =========================================================
+ *
+ * Random seed
+ *
+ * ========================================================= */
+
+ //reproducible random seed: if you don't change SEED above,
+ // you'll aways get the same result, NOT a random run
+ rng.reseed(seed);
+ int seed1=time(0);
+ srand(seed1);
+
+ /* =========================================================
+ *
+ * Initilisation of the solution
+ *
+ * ========================================================= */
+
+ solution sol(vecSize);
+ if(vecSize<64)
+ for(unsigned i=0;i eval;
+
+ /* =========================================================
+ *
+ * Evaluation of a solution neighbor's
+ *
+ * ========================================================= */
+
+ OneMaxIncrEval incr_eval;
+ moCudaVectorEval > cueval(vecSize,incr_eval);
+
+ /* =========================================================
+ *
+ * Comparator of solutions and neighbors
+ *
+ * ========================================================= */
+
+ moNeighborComparator comparator;
+ moSolNeighborComparator solComparator;
+
+ /* =========================================================
+ *
+ * a solution neighborhood
+ *
+ * ========================================================= */
+
+ Neighborhood neighborhood(vecSize,cueval);
+
+ /* =========================================================
+ *
+ * An explorer of solution neighborhood's
+ *
+ * ========================================================= */
+
+ moFirstImprHCexplorer explorer(neighborhood, cueval, comparator, solComparator);
+
+
+ /* =========================================================
+ *
+ * The local search algorithm
+ *
+ * ========================================================= */
+ // True continuator <=> Always continue
+
+ moTrueContinuator continuator;
+
+ moLocalSearch localSearch(explorer,continuator, eval);
+
+ /* =========================================================
+ *
+ * The First improvment algorithm
+ *
+ * ========================================================= */
+
+ moFirstImprHC firstImprHC(neighborhood,eval,cueval);
+
+ /* =========================================================
+ *
+ * Execute the local search from random sollution
+ *
+ * ========================================================= */
+
+ //Can be eval here, else it will be done at the beginning of the localSearch
+ eval(sol);
+
+ std::cout << "initial: " << sol.fitness()<< std::endl;
+ moCudaTimer timer;
+ timer.start();
+ localSearch(sol);
+ timer.stop();
+ printf("CUDA execution time = %f ms\n",timer.getTime());
+ timer.deleteTimer();
+ std::cout << "final: " << sol.fitness() << std::endl;
+
+ /* =========================================================
+ *
+ * Execute the first improvment from random sollution
+ *
+ * ========================================================= */
+
+ solution sol1(vecSize);
+ if(vecSize<64)
+ for(unsigned i=0;i
+#include
+using namespace std;
+
+// The general include for eo
+#include
+#include
+// Fitness function
+#include
+// Cuda Fitness function
+#include
+#include
+// One Max solution
+#include
+//To compute execution time
+#include
+// One Max neighbor
+#include
+// One Max ordered neighborhood
+#include
+// The Solution and neighbor comparator
+#include
+#include
+// The continuator
+#include
+// Simple HC algorithm
+#include
+
+
+// REPRESENTATION
+typedef moCudaBitVector solution;
+typedef moCudaBitNeighbor Neighbor;
+typedef moCudaOrderNeighborhood Neighborhood;
+
+void main_function(int argc, char **argv)
+{
+
+ /* =========================================================
+ *
+ * Parameters
+ *
+ * ========================================================= */
+
+ // First define a parser from the command-line arguments
+ eoParser parser(argc, argv);
+
+ // For each parameter, define Parameter, read it through the parser,
+ // and assign the value to the variable
+
+ // seed
+ eoValueParam seedParam(time(0), "seed", "Random number seed", 'S');
+ parser.processParam( seedParam );
+ unsigned seed = seedParam.value();
+
+ // description of genotype
+ eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V');
+ parser.processParam( vecSizeParam, "Representation" );
+ unsigned vecSize = vecSizeParam.value();
+
+ //nbStep maximum step to do
+ eoValueParam nbStepParam(10, "nbStep", "maximum number of step", 'N');
+ parser.processParam( nbStepParam, "numberStep" );
+ unsigned nbStep = nbStepParam.value();
+
+
+ // the name of the "status" file where all actual parameter values will be saved
+ string str_status = parser.ProgramName() + ".status"; // default value
+ eoValueParam statusParam(str_status.c_str(), "status", "Status file");
+ parser.processParam( statusParam, "Persistence" );
+
+ // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
+ // i.e. in case you need parameters somewhere else, postpone these
+ if (parser.userNeedsHelp()) {
+ parser.printHelp(cout);
+ exit(1);
+ }
+ if (statusParam.value() != "") {
+ ofstream os(statusParam.value().c_str());
+ os << parser;// and you can use that file as parameter file
+ }
+ /* =========================================================
+ *
+ * Random seed
+ *
+ * ========================================================= */
+
+ //reproducible random seed: if you don't change SEED above,
+ // you'll aways get the same result, NOT a random run
+ rng.reseed(seed);
+
+
+ /* =========================================================
+ *
+ * Initilisation of the solution
+ *
+ * ========================================================= */
+
+ solution sol(vecSize);
+ if(vecSize<64)
+ for(unsigned i=0;i eval;
+
+ /* =========================================================
+ *
+ * Evaluation of a solution neighbor's
+ *
+ * ========================================================= */
+
+ OneMaxIncrEval incr_eval;
+ moCudaVectorEval > cueval(vecSize,incr_eval);
+
+ /* =========================================================
+ *
+ * Comparator of solutions and neighbors
+ *
+ * ========================================================= */
+
+ moNeighborComparator comparator;
+ moSolNeighborComparator solComparator;
+
+ /* =========================================================
+ *
+ * a solution neighborhood
+ *
+ * ========================================================= */
+
+ Neighborhood neighborhood(vecSize,cueval);
+
+ /* =========================================================
+ *
+ * The simple Hill Climbing algorithm
+ *
+ * ========================================================= */
+ //True continuator <=> Always continue
+
+ moTrueContinuator continuator;
+
+ moNeutralHC neutralHC(neighborhood,eval,cueval,nbStep,continuator);
+
+ /* =========================================================
+ *
+ * Execute the neutralHill climbing from random sollution
+ *
+ * ========================================================= */
+
+ eval(sol);
+
+ std::cout << "initial: " << sol.fitness()<< std::endl;
+ moCudaTimer timer;
+ timer.start();
+ neutralHC(sol);
+ timer.stop();
+ printf("CUDA execution time = %f ms\n",timer.getTime());
+ timer.deleteTimer();
+ std::cout << "final: " << sol.fitness() << std::endl;
+
+}
+
+// A main that catches the exceptions
+
+int main(int argc, char **argv)
+{
+ try{
+ main_function(argc, argv);
+ }
+ catch(exception& e){
+ cout << "Exception: " << e.what() << '\n';
+ }
+ return 1;
+}
diff --git a/ParadisEO-GPU/tutoriel/OneMax/testSimpleHC.cu b/ParadisEO-GPU/tutoriel/OneMax/testSimpleHC.cu
new file mode 100644
index 000000000..4c87fe329
--- /dev/null
+++ b/ParadisEO-GPU/tutoriel/OneMax/testSimpleHC.cu
@@ -0,0 +1,222 @@
+//Init the number of threads per block
+#define BLOCK_SIZE 128
+#include
+#include