git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2698 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
boufaras 2012-01-30 11:22:35 +00:00
commit 6675e9596f
127 changed files with 16268 additions and 0 deletions

View file

@ -0,0 +1,5 @@
Authors:
Boufaras Karima
Thé Van Luong

File diff suppressed because it is too large Load diff

View file

@ -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")

View file

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

View file

@ -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 )

View file

@ -0,0 +1,100 @@
######################################################################################
### 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.1" CACHE STRING "GPU Package string full name" FORCE)
SET(PACKAGE_VERSION "1.1" CACHE STRING "Package version" FORCE)
SET(GLOBAL_VERSION "1.1" CACHE STRING "Global version" FORCE)
SET(VERSION "1.1.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(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(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2 -g -pg -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)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
ADD_DEFINITIONS(-DCMAKE_VERBOSE_MAKEFILE=ON)
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
##########################################################################################################################################
######################################################################################
### 3) Link the librairies for your executable
######################################################################################
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(test)
ADD_SUBDIRECTORY(tutorial)
######################################################################################

View file

@ -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)

View file

@ -0,0 +1,8 @@
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
"test/"
"paradiseo-eo/"
"paradiseo-mo/"
"paradiseo-gpu/"
"problems/"
)

View file

@ -0,0 +1,81 @@
PARADISEO-GPU README FILE
=======================================================================
check latest news at http://paradiseo.gforge.inria.fr/
=======================================================================
Welcome to ParadisEO-GPU, the reusable design and implementation of parallel meta-
heuristics on Graphics Processing Units (GPU).
The latest news about ParadisEO-GPU can be found on the gforge repository at
http://paradiseo.gforge.inria.fr/index.php?n=Doc.API
In case of any problem, please e-mail us at
paradiseo-help@lists.gforge.inria.fr
=======================================================================
BUILDING PARADISEO-PEO
=======================================================================
The basic installation procedure goes the following.
To compile paradiseo-gpu in the default directory,
go to paradiseo-gpu/build/ and run:
> cmake ..
> make
// for an easy-use of the provided lessons
> make install
// optional (if the documentation is not already available)
> make doc
To compile paradiseo-peo anywhere else, simply run:
> cmake $(GPU) -Dconfig=<path to the install.cmake file>
> make
// for an easy-use of the provided lessons
> make install
// optional (if the documentation is not already available)
> make doc
To clean everything, simply run
> make clean
===================================================================
DIRECTORY STRUCTURE
===================================================================
After unpacking the archive file, you should end up with the following
structure:
.../ The main PARADISEO-GPU directory, created when unpacking.
|
+-- build BUILD directory that contains libraries and executable files.
|
+-- src SOURCE directory Contains most PARADISEO-GPU .h files.
|
+-- doc DOCUMENTATION directory (generated by Doxygen).
| |
| +- html HTML files - start at index.html.
| |
| +- latex latex files - use to generate Postcript doc.
| |
| +- man Unix man format documentation.
|
|
+-- tutorial APPLICATIONS
|
+-- INSTANCES The instances problem directory (QAP instances ...)
|
+-- OneMax How make One max problem with parallel evalution of neighborhood(bit flipping) with hamming distances =1
|
+-- KswapOneMax How make One max problem with parallel evalution of neighborhood(bit flipping) with hamming distances >=1
|
+-- PPP_GPU How make Permuted Perceptron Problem with parallel evalution of neighborhood on GPU
|
+-- QAP_GPU How make Quadratic Assignement Problem with parallel evaluation of neighborhood on GPU
|
+-- QAP_CPU How make Quadratic Assignement Problem with sequentiel evaluation of neighborhood on CPU
===================================================================
NOTES
===================================================================
Mailing list : paradiseo-help@lists.gforge.inria.fr

View file

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

View file

@ -0,0 +1,275 @@
# Doxyfile 1.7.1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
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 = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_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
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
TYPEDEF_HIDES_STRUCT = NO
SYMBOL_CACHE_SIZE = 0
EXTENSION_MAPPING =
BUILTIN_STL_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
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_GROUP_NAMES = 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 = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
#---------------------------------------------------------------------------
# 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@
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.cu \
*.cpp \
*.h \
NEWS README
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = *::*
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 = moGPU
#---------------------------------------------------------------------------
# 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
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE =
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHG_LOCATION =
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
FORMULA_FONTSIZE = 10
BINARY_TOC = NO
TOC_EXPAND = NO
#---------------------------------------------------------------------------
# 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 = @EO_BIN_DIR@/doc/eo.doxytag=http://eodev.sourceforge.net/eo/doc/html \
@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
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_FONTNAME = FreeSans
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
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 = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = YES

View file

@ -0,0 +1,58 @@
/** @mainpage Welcome ParadisEO GPU
@section Introduction Introduction
ParadisEO-GPU is a white-box object-oriented generic framework dedicated to the flexible design of parallel local search algorithms on GPU (hill-climbing, tabu search ...)
@section tutorials Tutorials
Tutorials for ParadisEO-GPU are available in the "Tutorials section" of the <a href="http://paradiseo.gforge.inria.fr/index.php?n=Doc.Tutorials">ParadisEO tutorials</a>.
@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 <a href="http://paradiseo.gforge.inria.fr">ParadisEO website</a>.
@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 <a href="http://paradiseo.gforge.inria.fr">homepage</a>
- INRIA GForge <a href="http://gforge.inria.fr/projects/paradiseo/">project page</a>
- Fore any questions, please contact paradiseo-help@lists.gforge.inria.fr
*/

View file

@ -0,0 +1,18 @@
#######################################################################################
### Paths to EO, MO and GPU must be specified above.
#######################################################################################
SET(EO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-eo" CACHE PATH "ParadisEO-EO source directory" FORCE)
SET(EO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-eo/build" CACHE PATH "ParadisEO-EO binary directory" FORCE)
SET(MO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-mo" CACHE PATH "ParadisMO-MO source directory" FORCE)
SET(MO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE)
SET(GPU_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-gpu" CACHE PATH "ParadisEO-GPU source directory" FORCE)
SET(GPU_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-gpu/build" CACHE PATH "ParadisEO-GPU binary directory" FORCE)
SET(PROBLEMS_SRC_DIR "${CMAKE_SOURCE_DIR}/../problems" CACHE PATH "Problems dependant source directory" FORCE)
SET(CUDA_DIR "/usr/local/cuda" CACHE PATH "cuda directory" FORCE)

View file

@ -0,0 +1,141 @@
/*
<moGPUBitVector.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
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 __moGPUBitVector_H_
#define __moGPUBitVector_H_
#include <GPUType/moGPUVector.h>
#include <stdlib.h>
/**
* Implementation of Bit vector representation on GPU.
*/
template<class Fitness>
class moGPUBitVector: public moGPUVector<bool, Fitness> {
public:
/**
* Define bool vector corresponding to Solution
**/
typedef bool ElemType;
using moGPUVector<bool, Fitness>::vect;
using moGPUVector<bool, Fitness>::N;
/**
* Default constructor.
*/
moGPUBitVector() :
moGPUVector<bool, Fitness> () {
}
/**
*Constructor.
*@param _neighborhoodSize The neighborhood size.
*/
moGPUBitVector(unsigned _neighborhoodSize) :
moGPUVector<bool, Fitness> (_neighborhoodSize) {
create();
}
/**
*Constructor.
*@param _neighborhoodSize The neighborhood size.
*@param _b Value to assign to vector.
*/
moGPUBitVector(unsigned _neighborhoodSize, bool _b) :
moGPUVector<bool, Fitness> (_neighborhoodSize) {
for (unsigned i = 0; i < _neighborhoodSize; i++)
vect[i] = _b;
}
/**
*Initializer of random bit vector.
*/
void create() {
for (unsigned i = 0; i < N; i++) {
vect[i] = (int) (rng.rand() / RAND_MAX);
}
}
/**
*Function inline to set the size of vector, called from host.
*@param _size the vector size
*/
void setSize(unsigned _size) {
if (_size < N) {
moGPUBitVector<Fitness> tmp_vect(_size);
for (unsigned i = 0; i < tmp_vect.N; i++)
tmp_vect.vect[i] = vect[i];
(tmp_vect).invalidate();
(*this) = tmp_vect;
} else if (_size > N) {
moGPUBitVector<Fitness> tmp_vect(_size);
for (unsigned i = 0; i < N; i++)
tmp_vect.vect[i] = vect[i];
(tmp_vect).invalidate();
(*this) = tmp_vect;
}
}
/**
* Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream.
*/
void printOn(std::ostream& _os) const {
EO<Fitness>::printOn(_os);
_os << ' ';
_os << N << ' ';
for (unsigned int i = 0; i < N; i++)
_os << (*this)[i] << ' ';
}
};
#endif

View file

@ -0,0 +1,122 @@
/*
<moGPUIntVector.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
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 __moGPUIntVector_H_
#define __moGPUIntVector_H_
#include <GPUType/moGPUVector.h>
#include <stdlib.h>
/**
* Implementation of integer vector representation on GPU.
*/
template<class Fitness>
class moGPUIntVector: public moGPUVector<int, Fitness> {
public:
using moGPUVector<int, Fitness>::vect;
using moGPUVector<int, Fitness>::N;
/**
* Default constructor.
*/
moGPUIntVector() :
moGPUVector<int, Fitness> () {
}
/**
*Constructor.
*@param _neighborhoodSize The neighborhood size.
*/
moGPUIntVector(unsigned _neighborhoodSize) :
moGPUVector<int, Fitness> (_neighborhoodSize) {
create();
}
/**
*Initializer of random integer vector.
*/
virtual void create() {
for (unsigned i = 0; i < N; i++)
vect[i] = ((int) (rng.rand())) % N + 1;
}
/**
*Function inline to set the size of vector, called from host.
*@param _size the vector size
*/
virtual inline __host__ void setSize(unsigned _size) {
if(N==_size)
return;
moGPUIntVector<Fitness> tmp_vect(_size);
if(_size<N) {
for (unsigned i = 0; i < tmp_vect.N; i++)
tmp_vect.vect[i]= vect[i];
}
else if(_size>N) {
for (unsigned i = 0; i <N; i++)
tmp_vect.vect[i]= vect[i];
}
(tmp_vect).invalidate();
(*this)=tmp_vect;
}
/**
* Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream.
*/
void printOn(std::ostream& _os) const {
EO<Fitness>::printOn(_os);
_os << ' ';
_os << N << ' ';
unsigned int i;
for (i = 0; i < N; i++)
_os << vect[i] << ' ';
}
};
#endif

View file

@ -0,0 +1,92 @@
/*
<moGPUPermutationVector.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
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 __moGPUPermutationVector_H_
#define __moGPUPermutationVector_H_
#include <GPUType/moGPUIntVector.h>
/**
* Implementation of Permutation vector representation on GPU.
*/
template<class Fitness>
class moGPUPermutationVector: public moGPUIntVector<Fitness> {
public:
using moGPUIntVector<Fitness>::vect;
using moGPUIntVector<Fitness>::N;
/**
* Default constructor.
*/
moGPUPermutationVector() :
moGPUIntVector<Fitness> () {
}
/**
*Constructor.
*@param _size The solution size.
*/
moGPUPermutationVector(unsigned _size) :
moGPUIntVector<Fitness> (_size) {
create();
}
/**
*Initializer of random permuatation vector.
*/
void create() {
unsigned random;
int tmp;
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 = rng.rand() % (N - i) + i;
tmp = vect[i];
vect[i] = vect[random];
vect[random] = tmp;
}
}
};
#endif

View file

@ -0,0 +1,123 @@
/*
<moGPURealVector.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
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 __moGPURealVector_H_
#define __moGPURealVector_H_
#include <GPUType/moGPUVector.h>
#include <stdlib.h>
/**
* Implementation of real vector representation on GPU.
*/
template<class Fitness>
class moGPURealVector: public moGPUVector<float, Fitness> {
public:
using moGPUVector<float, Fitness>::vect;
using moGPUVector<float, Fitness>::N;
/**
* Default constructor.
*/
moGPURealVector() :
moGPUVector<float, Fitness> () {
}
/**
*Constructor.
*@param _neighborhoodSize The neighborhood size.
*/
moGPURealVector(unsigned _neighborhoodSize) :
moGPUVector<float, Fitness> (_neighborhoodSize) {
create();
}
/**
*Initializer of random real vector.
*/
void create() {
for (unsigned i = 0; i < N; i++)
vect[i] = N*rng.rand() /((float) RAND_MAX+1);
}
/**
*Function inline to set the size of vector, called from host.
*@param _size the vector size
*/
virtual inline __host__ void setSize(unsigned _size) {
if(_size<N) {
moGPURealVector<Fitness> tmp_vect(_size);
for (unsigned i = 0; i < tmp_vect.N; i++)
tmp_vect.vect[i]= vect[i];
(tmp_vect).invalidate();
(*this)=tmp_vect;
}
else if(_size>N) {
moGPURealVector<Fitness> tmp_vect(_size);
for (unsigned i = 0; i <N; i++)
tmp_vect.vect[i]= vect[i];
(tmp_vect).invalidate();
(*this)=tmp_vect;
}
}
/**
* Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream.
*/
void printOn(std::ostream& _os) const {
EO<Fitness>::printOn(_os);
_os << ' ';
_os << N << ' ';
unsigned int i;
for (i = 0; i < N; i++)
_os << vect[i] << ' ';
}
};
#endif

View file

@ -0,0 +1,184 @@
/*
<moGPUVector.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
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 __moGPUVector_H_
#define __moGPUVector_H_
#include <eo>
/**
* Implementation of a GPU solution representation.
*/
template<class ElemT, class Fitness>
class moGPUVector: public EO<Fitness> {
public:
/**
* Define vector type corresponding to Solution
*/
typedef ElemT ElemType;
/**
* Default constructor.
*/
moGPUVector() :
N(0) {
}
/**
*Constructor.
*@param _size The solution size.
*/
moGPUVector(unsigned _size) :
N(_size) {
vect = new ElemType[N];
}
/**
*Copy Constructor
*@param _vector The vector passed to the function to determine the new content.
*/
moGPUVector(const moGPUVector & _vector) {
N = _vector.N;
vect = new ElemType[N];
for (unsigned i = 0; i < N; i++)
vect[i] = _vector.vect[i];
if (!(_vector.invalid()))
fitness(_vector.fitness());
else
(*this).invalidate();
}
/**
* Destructor.
*/
~moGPUVector() {
if (N >= 1)
delete[] vect;
}
/**
*How to fill the solution vector.
*/
virtual void create() =0;
/**
*Assignment operator
*@param _vector The vector passed to the function to determine the new content.
*@return a new vector.
*/
moGPUVector& operator=(const moGPUVector & _vector) {
if (!(N == _vector.N)) {
N = _vector.N;
vect = new ElemType[N];
}
for (unsigned i = 0; i < N; i++){
vect[i] = _vector[i];
}
if (!(_vector.invalid()))
fitness(_vector.fitness());
else
(*this).invalidate();
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;
}
/**
* method to set the size of vector
*@param _size the vector size
*/
virtual void setSize(unsigned _size)=0;
/**
* Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream.
*/
virtual void printOn(std::ostream& _os) const=0;
protected:
ElemType * vect;
unsigned N;
};
#endif

View file

@ -0,0 +1,146 @@
/*
<moGPUEval.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
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 moGPUEval_H
#define moGPUEval_H
#include <eval/moEval.h>
/**
* Abstract class for evaluation on GPU
*/
template<class Neighbor>
class moGPUEval: public moEval<Neighbor> {
public:
/**
* Define type of a solution corresponding to Neighbor
**/
typedef typename Neighbor::EOT EOT;
/**
* Define type of a fitness corresponding to Solution
**/
typedef typename EOT::Fitness Fitness;
/**
* Define type of a vector corresponding to Solution
*/
typedef typename EOT::ElemType T;
/**
* Constructor
* @param _neighborhoodSize the size of the neighborhood
*/
moGPUEval(unsigned int _neighborhoodSize) {
neighborhoodSize = _neighborhoodSize;
host_FitnessArray = new Fitness[neighborhoodSize];
cudaMalloc((void**) &device_FitnessArray, neighborhoodSize
* sizeof(Fitness));
mutex = false;
#ifdef BLOCK_SIZE
NEW_kernel_Dim = neighborhoodSize / BLOCK_SIZE + ((neighborhoodSize
% BLOCK_SIZE == 0) ? 0 : 1);
NEW_BLOCK_SIZE = BLOCK_SIZE;
#endif
}
/**
* Destructor
*/
~moGPUEval() {
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()]);
}
/**
* Compute fitness for all solution neighbors in device
* @param _sol the solution which generate the neighborhood
* @param _cpySolution Launch kernel with local copy option of solution in each thread
* @param _withCalibration an automatic configuration of kernel to launch( NB_THREAD BY BLOCK & NB_BLOCK BY KERNEL ),default (1)
*/
virtual void neighborhoodEval(EOT & _sol, bool _cpySolution,
bool _withCalibration) {
}
/**
* Compute fitness for all solution neighbors in device
* @param _sol the solution which generate the neighborhood
* @param _mapping the associated neighborhood mapping
* @param _cpySolution Launch kernel with local copy option of solution in each thread
* @param _withCalibration an automatic configuration of kernel to launch( NB_THREAD BY BLOCK & NB_BLOCK BY KERNEL ), default (1)
*/
virtual void neighborhoodEval(EOT & _sol, unsigned int * _mapping,
bool _cpySolution, bool _withCalibration) {
}
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;
//Assure mapping transfer from CPU memory to GPU global memory for once time
unsigned mutex;
//GPU kernel dimension
unsigned NEW_BLOCK_SIZE;
unsigned NEW_kernel_Dim;
};
#endif

View file

@ -0,0 +1,200 @@
/*
<moGPUEvalByCpy.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
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 __moGPUEvalByCpy_H
#define __moGPUEvalByCpy_H
#include <eval/moGPUEval.h>
#include <eval/moGPUKernelEvalByCpy.h>
#include <performance/moGPUTimer.h>
/**
* class for the parallel evaluation of neighborhood
*/
template<class Neighbor, class Eval>
class moGPUEvalByCpy: public moGPUEval<Neighbor> {
public:
/**
* Define type of a solution corresponding to Neighbor
**/
typedef typename Neighbor::EOT EOT;
/**
* Define vector type of vector corresponding to Solution
**/
typedef typename EOT::ElemType T;
/**
* Define type of a fitness corresponding to Solution
**/
typedef typename EOT::Fitness Fitness;
using moGPUEval<Neighbor>::neighborhoodSize;
using moGPUEval<Neighbor>::host_FitnessArray;
using moGPUEval<Neighbor>::device_FitnessArray;
using moGPUEval<Neighbor>::device_solution;
using moGPUEval<Neighbor>::NEW_kernel_Dim;
using moGPUEval<Neighbor>::NEW_BLOCK_SIZE;
using moGPUEval<Neighbor>::mutex;
/**
* Constructor
* @param _neighborhoodSize the size of the neighborhood
* @param _eval how to evaluate a neighbor
*/
moGPUEvalByCpy(unsigned int _neighborhoodSize, Eval & _eval) :
moGPUEval<Neighbor> (_neighborhoodSize), eval(_eval) {
}
/**
* Compute fitness for all solution neighbors in device
* @param _sol the solution that generate the neighborhood to evaluate parallely
* @param _cpySolution Launch kernel with local copy option of solution in each thread
* @param _withCalibration an automatic configuration of kernel to launch( NB_THREAD BY BLOCK & NB_BLOCK BY KERNEL ),default (1)
*/
void neighborhoodEval(EOT & _sol, bool _cpySolution, bool _withCalibration) {
if (_cpySolution) {
unsigned size=_sol.size();
if (!mutex) {
//Allocate the space for solution in the global memory of device
cudaMalloc((void**) &device_solution.vect, size * sizeof(T));
if (_withCalibration)
calibration(_sol);
mutex = true;
}
// Get Current solution fitness
Fitness fitness = _sol.fitness();
//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 with local copy of solution
moGPUKernelEvalByCpy<T,Fitness,Eval><<<NEW_kernel_Dim,NEW_BLOCK_SIZE >>>(eval,device_solution.vect,device_FitnessArray,fitness,neighborhoodSize);
//Copy the result from device to host
cudaMemcpy(host_FitnessArray, device_FitnessArray, neighborhoodSize
* sizeof(Fitness), cudaMemcpyDeviceToHost);
} else
cout << "It's evaluation by copy set cpySolution to true" << endl;
}
/**
* Compute the best combination of number of block by grid and number of thread within block
* @param _sol the solution that generate the neighborhood to evaluate parallely
*/
virtual void calibration(EOT & _sol) {
unsigned size = _sol.size();
Fitness fitness = _sol.fitness();
unsigned NB_THREAD[6] = { 16, 32, 64, 128, 256, 512 };
double mean_time[7] = { 0, 0, 0, 0, 0, 0 };
unsigned i = 0;
double best_time = RAND_MAX;
unsigned tmp_kernel_Dim;
#ifndef BLOCK_SIZE
do {
tmp_kernel_Dim = neighborhoodSize / NB_THREAD[i]
+ ((neighborhoodSize % NB_THREAD[i] == 0) ? 0 : 1);
for (unsigned k = 0; k < 5; k++) {
cudaMemcpy(device_solution.vect, _sol.vect, size * sizeof(T),
cudaMemcpyHostToDevice);
moGPUTimer timer;
timer.start();
moGPUKernelEvalByCpy<T,Fitness,Eval><<<tmp_kernel_Dim,NB_THREAD[i] >>>(eval,device_solution.vect,device_FitnessArray,fitness,neighborhoodSize);
timer.stop();
mean_time[i] += (timer.getTime());
}
if (best_time >= (mean_time[i] / 5)) {
best_time = mean_time[i] / 5;
NEW_BLOCK_SIZE = NB_THREAD[i];
NEW_kernel_Dim = tmp_kernel_Dim;
}
i++;
} while (i < 6);
#else
tmp_kernel_Dim =NEW_kernel_Dim;
for (unsigned k = 0; k < 5; k++) {
cudaMemcpy(device_solution.vect, _sol.vect, size * sizeof(T),
cudaMemcpyHostToDevice);
moGPUTimer timer;
timer.start();
moGPUKernelEvalByCpy<T,Fitness,Eval><<<tmp_kernel_Dim,BLOCK_SIZE >>>(eval,device_solution.vect,device_FitnessArray,fitness,neighborhoodSize);
timer.stop();
mean_time[6] += (timer.getTime());
}
if (best_time >= (mean_time[6] / 5))
best_time = mean_time[6] / 5;
do {
tmp_kernel_Dim = neighborhoodSize / NB_THREAD[i]
+ ((neighborhoodSize % NB_THREAD[i] == 0) ? 0 : 1);
for (unsigned k = 0; k < 5; k++) {
cudaMemcpy(device_solution.vect, _sol.vect, size * sizeof(T),
cudaMemcpyHostToDevice);
moGPUTimer timer;
timer.start();
moGPUKernelEvalByCpy<T,Fitness,Eval><<<tmp_kernel_Dim,NB_THREAD[i] >>>(eval,device_solution.vect,device_FitnessArray,fitness,neighborhoodSize);
timer.stop();
mean_time[i] += (timer.getTime());
}
if (best_time >= (mean_time[i] / 5)) {
best_time = mean_time[i] / 5;
NEW_BLOCK_SIZE = NB_THREAD[i];
NEW_kernel_Dim = tmp_kernel_Dim;
}
i++;
}while (i < 6);
#endif
}
protected:
Eval & eval;
};
#endif

Some files were not shown because too many files have changed in this diff Show more