Migration from SVN
This commit is contained in:
parent
d7d6c3a217
commit
8cd56f37db
29069 changed files with 0 additions and 4096888 deletions
|
|
@ -1,13 +0,0 @@
|
|||
Jean-Charles Boisson
|
||||
Sébastien Cahon
|
||||
Clive Canape
|
||||
Laetitia Jourdan
|
||||
Thomas Legrand
|
||||
Arnaud Liefooghe
|
||||
Nouredine Melab
|
||||
El-Ghazali Talbi
|
||||
Alexandru-Adrian Tantar
|
||||
Sebastien Verel
|
||||
Jérémie Humeau
|
||||
Karima Boufaras
|
||||
Thé van Luong
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
#############################################################################
|
||||
# Dart config for report submission
|
||||
#############################################################################
|
||||
|
||||
SET (DROP_METHOD "xmlrpc")
|
||||
SET (DROP_SITE "http://dart.irisa.fr")
|
||||
SET (DROP_LOCATION "ParadisEO")
|
||||
SET (NIGHTLY_START_TIME "23:00:00 WEST")
|
||||
#############################################################################
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
==========================================================================================
|
||||
RELEASE
|
||||
==========================================================================================
|
||||
|
||||
The current release is paradisEO-1.3
|
||||
|
||||
==========================================================================================
|
||||
INSTALLATION
|
||||
==========================================================================================
|
||||
The basic installation procedure must be done in the directory
|
||||
which contains the extracted archive.
|
||||
|
||||
--> Example : bash installParadiseo.sh
|
||||
|
||||
Please try source installParadiseo.sh --help for further information
|
||||
|
||||
==========================================================================================
|
||||
DIRECTORY STRUCTURE
|
||||
==========================================================================================
|
||||
After unpacking the archive file, you should end up with the following
|
||||
structure:
|
||||
|
||||
.../ Installation directory (specified with ./installParadiseo.sh)
|
||||
|
|
||||
|
|
||||
+-- AUTHORS Author list
|
||||
|
|
||||
|
|
||||
+-- downloads/
|
||||
| | +-- /cudatoolkit_3.2.16_linux_32_ubuntu10.04.run CUDA toolkit (required for ParadisEO-GPU)
|
||||
| +-- /devdriver_3.2_linux_32_260.19.26.run CUDA driver (required for ParadisEO-GPU)
|
||||
|
|
||||
+-- INSTALL INSTALL file
|
||||
|
|
||||
|
|
||||
+-- install.cmake ParadisEO-GPU main install config file
|
||||
|
|
||||
|
|
||||
+-- installParadiseo.sh Install script
|
||||
|
|
||||
|
|
||||
+-- logs Log files
|
||||
|
|
||||
|
|
||||
+ LICENCE Licence contents
|
||||
|
|
||||
|
|
||||
+-- paradiseo-eo paradiseo-eo dir
|
||||
|
|
||||
|
|
||||
+-- paradiseo-gpu paradiseo-gpu dir
|
||||
|
|
||||
|
|
||||
+-- paradiseo-mo paradiseo-mo dir
|
||||
|
|
||||
|
|
||||
+-- problems classical problems evaluation functions
|
||||
|
|
||||
|
|
||||
+-- README README file
|
||||
|
||||
==========================================================================================
|
||||
NOTES
|
||||
==========================================================================================
|
||||
|
||||
ParadisEO-GPU uses EO and MO, a templates-based, ANSI-C++ compliant evolutionary computation library and Moving Object Library.
|
||||
It contains classes for almost any kind of evolutionary computation and local search algorithms you might come up to - at
|
||||
least for the ones we could think of.
|
||||
EO Website: http://eodev.sourceforge.net/.
|
||||
EO is distributed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr/.
|
||||
Please read README file of each extracted directory if you have
|
||||
problems for the installation.
|
||||
|
||||
==========================================================================================
|
||||
CONTACT
|
||||
==========================================================================================
|
||||
For further information about ParadisEO, help or to report any
|
||||
problem : paradiseo-help@lists.gforge.inria.fr
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,107 +0,0 @@
|
|||
######################################################################################
|
||||
### CMake basic configuration
|
||||
######################################################################################
|
||||
|
||||
# check cmake version compatibility
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
|
||||
# regular expression checking
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
|
||||
|
||||
# set a language for the entire project.
|
||||
ENABLE_LANGUAGE(CXX)
|
||||
ENABLE_LANGUAGE(C)
|
||||
|
||||
####################################################################################
|
||||
|
||||
|
||||
#####################################################################################
|
||||
### Include required modules & utilities
|
||||
#####################################################################################
|
||||
INCLUDE(CMakeBackwardCompatibilityCXX)
|
||||
|
||||
INCLUDE(FindDoxygen)
|
||||
|
||||
INCLUDE(FindGnuplot)
|
||||
|
||||
INCLUDE(CheckLibraryExists)
|
||||
|
||||
INCLUDE(Dart OPTIONAL)
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
#####################################################################################
|
||||
### 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(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers")
|
||||
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)
|
||||
|
||||
#####################################################################################
|
||||
|
||||
######################################################################################
|
||||
### compilation of examples?
|
||||
######################################################################################
|
||||
|
||||
SET(ENABLE_CMAKE_EXAMPLE TRUE CACHE BOOL "Enable copy of benchs and parameters file?")
|
||||
|
||||
######################################################################################
|
||||
### Test config
|
||||
######################################################################################
|
||||
|
||||
IF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING)
|
||||
ENABLE_TESTING()
|
||||
ENDIF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING)
|
||||
######################################################################################
|
||||
|
||||
#######################################################################################
|
||||
### Paths to EO, MO and MOEO 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)
|
||||
|
||||
######################################################################################
|
||||
######################################################################################
|
||||
### Subdirectories that CMake should process for EO, MO and GPU
|
||||
######################################################################################
|
||||
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
ADD_SUBDIRECTORY(src)
|
||||
ADD_SUBDIRECTORY(test)
|
||||
ADD_SUBDIRECTORY(tutorial)
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,583 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
# Project : paradisEO-GPU full package install
|
||||
# File : installParadiseo-gpu.sh
|
||||
# Comment : # This file attempts to install ParadisEO-GPU #
|
||||
#
|
||||
#########################################################################################
|
||||
|
||||
# global variables
|
||||
installStartTime=$SECONDS
|
||||
resourceKitPath=$PWD
|
||||
TAR_MSG=" "
|
||||
DIE=0
|
||||
PROG=ParadisEO-GPU
|
||||
CMAKE_PRIMARY_CONFIG_FILE=install.cmake
|
||||
HOME_PATH=$HOME
|
||||
CUDA=" " #****
|
||||
bash_path='$PATH'
|
||||
library_path='$LD_LIBRARY_PATH'
|
||||
|
||||
# generator types available on Unix platforms
|
||||
P_UNIX_MAKEFILES=1
|
||||
G_UNIX_MAKEFILES="Unix Makefiles"
|
||||
|
||||
# should we compile ParadisEO ?
|
||||
COMPILE_PARADISEO=1
|
||||
|
||||
# Build types
|
||||
DEFAULT_BUILD_TYPE=Release
|
||||
BUILD_TYPE=$DEFAULT_BUILD_TYPE
|
||||
|
||||
# CMake/CTest/Dart flags
|
||||
CTEST_DEFAULT_CONFIG="-D ExperimentalStart -D ExperimentalBuild -D ExperimentalTest"
|
||||
CTEST_CONFIG=$CTEST_DEFAULT_CONFIG
|
||||
|
||||
# What are the tests that should be always run ?
|
||||
MIN_CMAKE_FLAGS='-DENABLE_MINIMAL_CMAKE_TESTING=TRUE'
|
||||
|
||||
# install types to select in the main menu
|
||||
P_FULL_INSTALL=1
|
||||
P_RM_PREVIOUS_INSTALLL=2
|
||||
P_EXIT_INSTALL=3
|
||||
|
||||
IS_CUDA_INSTALLED=1
|
||||
|
||||
# install steps
|
||||
S_INTRODUCTION=1000
|
||||
S_UNPACK_EO=1001
|
||||
S_INSTALL_EO=1002
|
||||
S_INSTALL_MO=1003
|
||||
S_INSTALL_CUDA=1004 #****
|
||||
S_INSTALL_GPU=1005 #****
|
||||
S_CONFIGURE_ENV=1006
|
||||
S_REMOVE_INSTALL=1007
|
||||
S_END=1008
|
||||
#S_CHECK_AUTOTOOLS=1018
|
||||
|
||||
#### define what are the possible installs and their content
|
||||
|
||||
# full install
|
||||
|
||||
FULL_INSTALL="$S_INTRODUCTION $S_INSTALL_EO $S_INSTALL_MO $S_INSTALL_CUDA $S_INSTALL_GPU $S_END"
|
||||
|
||||
# remove a previous install
|
||||
RM_PREVIOUS_INSTALL="$S_REMOVE_INSTALL"
|
||||
|
||||
#others
|
||||
LIBS_PATH=lib
|
||||
# errors
|
||||
SUCCESSFUL_STEP=0
|
||||
EO_UNPACKING_ERROR=100
|
||||
EO_INSTALL_ERROR=104
|
||||
MO_INSTALL_ERROR=108
|
||||
GPU_INSTALL_ERROR=112 #****
|
||||
CUDA_INSTALLING_ERROR=116 #****
|
||||
REMOVE_TEMP_DIRECTORY_ERROR=113
|
||||
VAR_CONFIG_ERROR=114
|
||||
RM_PARADISEO_EO_ERROR=119
|
||||
DART_SUBMISSION_ERROR=64
|
||||
|
||||
#Date
|
||||
DATE=`/bin/date '+%Y%m%d%H%M%S'`
|
||||
# create log file
|
||||
SPY=$PWD/logs/install-paradiseo-gpu.${DATE}.log
|
||||
|
||||
#------------------------------------------------------#
|
||||
#-- FUNCTION : execute_cmd ---#
|
||||
#------------------------------------------------------#
|
||||
#-- PARAMETERS : ---#
|
||||
#-- $1 : cmd line ---#
|
||||
#-- $2 : comment ---#
|
||||
#-- $3 : spy file ---#
|
||||
#-- $4 : output std file ---#
|
||||
#-- $5 : error log file ---#
|
||||
#-- ---#
|
||||
#------------------------------------------------------#
|
||||
#-- CODE RETURN : 0 : OK ---#
|
||||
#-- CODE RETURN : 1 : NOK ---#
|
||||
#------------------------------------------------------#
|
||||
function execute_cmd
|
||||
{
|
||||
COMMAND=${1}
|
||||
COMMENT=${2}
|
||||
FIC_ESP=${3}
|
||||
FIC_OUT=${4}
|
||||
FIC_ERR=${5}
|
||||
|
||||
if [ `echo ${FIC_OUT} | wc -c` -eq 1 ]
|
||||
then
|
||||
FIC_OUT=${FIC_ESP}
|
||||
fi
|
||||
|
||||
if [ `echo ${FIC_ERR} | wc -c` -eq 1 ]
|
||||
then
|
||||
FIC_ERR=${FIC_ESP}
|
||||
fi
|
||||
|
||||
echo "" >> ${FIC_ESP}
|
||||
echo "[execute_cmd][Begin][`/bin/date +%H:%M:%S`]" >> ${FIC_ESP}
|
||||
|
||||
echo "------------------------------------------------------------------------------------------------------------" >> ${FIC_ESP}
|
||||
echo "${COMMENT}" >> ${FIC_ESP}
|
||||
echo "------------------------------------------------------------------------------------------------------------" >> ${FIC_ESP}
|
||||
echo "${COMMAND}" >> ${FIC_ESP}
|
||||
|
||||
${COMMAND} >> ${FIC_OUT} 2>> ${FIC_ERR}
|
||||
|
||||
RETURN_CODE=$?
|
||||
echo "RETURN_CODE : ${RETURN_CODE}" >> ${FIC_ESP}
|
||||
|
||||
if [ ${RETURN_CODE} -eq 0 ]
|
||||
then
|
||||
echo " ${COMMENT} OK" >> ${FIC_ESP}
|
||||
echo "[execute_cmd][End][`/bin/date +%H:%M:%S`]" >> ${FIC_ESP}
|
||||
return 0
|
||||
else
|
||||
echo " $ERROR_TAG ${COMMENT} NOK" >> ${FIC_ESP}
|
||||
return ${RETURN_CODE}
|
||||
fi
|
||||
}
|
||||
|
||||
#------------------------------------------------------#
|
||||
#-- FUNCTION : on_error ---#
|
||||
#------------------------------------------------------#
|
||||
#-- PARAMETERS : ---#
|
||||
#-- Error number ---#
|
||||
#------------------------------------------------------#
|
||||
#-- RETURN: ---#
|
||||
#------------------------------------------------------#
|
||||
function on_error()
|
||||
{
|
||||
case $1 in
|
||||
$CUDA_INSTALLING_ERROR)
|
||||
echo
|
||||
echo " An error has occured : impossible to install CudaToolkit.See $SPY for more details"
|
||||
echo "If you need help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
|
||||
echo
|
||||
echo
|
||||
kill $$;;
|
||||
|
||||
$EO_INSTALL_ERROR)
|
||||
echo
|
||||
echo " An error has occured : impossible to install Paradiseo-EO.See $SPY for more details"
|
||||
echo "If you need help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
|
||||
echo
|
||||
echo
|
||||
kill $$;;
|
||||
|
||||
$MO_INSTALL_ERROR)
|
||||
echo
|
||||
echo " An error has occured : impossible to install Paradiseo-MO.See $SPY for more details"
|
||||
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
|
||||
echo
|
||||
kill $$;;
|
||||
|
||||
$MOEO_INSTALL_ERROR)
|
||||
echo
|
||||
echo " An error has occured : impossible to install Paradiseo-MOEO.See $SPY for more details"
|
||||
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
|
||||
echo
|
||||
kill $$;;
|
||||
|
||||
$RM_PARADISEO_EO_ERROR)
|
||||
echo
|
||||
echo " An error has occured : impossible to remove ParadisEO-EO. See $SPY for more details"
|
||||
echo " You may not have a previous ParadisEO install available in the current directory"
|
||||
echo " => To report any problem or for help, please contact paradiseo-help@lists.gforge.inria.fr and join $SPY"
|
||||
echo
|
||||
kill $$;;
|
||||
|
||||
$SUCCESSFUL_STEP)
|
||||
;;
|
||||
*)
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#------------------------------------------------------#
|
||||
#-- FUNCTION : run_install_step ---#
|
||||
#------------------------------------------------------#
|
||||
#-- PARAMETERS : ---#
|
||||
#-- install path ---#
|
||||
#-- step to launch (0,1 ...) ---#
|
||||
#-- counter for loop ---#
|
||||
#-- Major function for install ---#
|
||||
#------------------------------------------------------#
|
||||
#-- RETURN: 0 if install OK ---#
|
||||
#------------------------------------------------------#
|
||||
|
||||
function run_install_step()
|
||||
{
|
||||
installKitPath=$1
|
||||
stepToRun=$2
|
||||
currentStepCounter=$3
|
||||
RETURN=0
|
||||
|
||||
case "$stepToRun" in
|
||||
|
||||
$S_INTRODUCTION)
|
||||
########## Introduction #########
|
||||
clear
|
||||
echo ""
|
||||
echo -e ' \033[40m\033[1;33m### ParadisEO-GPU install starting .... ### \033[0m '
|
||||
echo
|
||||
echo "Installing the environment for ParadisEO-GPU... To avoid build and test reports to be sent to our repository, please stop the program and restart it using the --skipdart option."
|
||||
sleep 6
|
||||
echo
|
||||
echo
|
||||
return $SUCCESSFUL_STEP
|
||||
;;
|
||||
|
||||
$S_INSTALL_EO)
|
||||
########## installing paradiseo-eo ##########
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
|
||||
echo ' --> Installing Paradiseo-EO. Please wait ...'
|
||||
|
||||
if [ ! "$installKitPath" = "$resourceKitPath" ]
|
||||
then
|
||||
cp -Rf $resourceKitPath/paradiseo-eo/ $installKitPath/
|
||||
rm -Rf $installKitPath/paradiseo-eo/build
|
||||
fi
|
||||
|
||||
execute_cmd "mkdir $installKitPath/paradiseo-eo/build" "[$currentStepCounter-1] Create build directory" $SPY
|
||||
|
||||
execute_cmd "cd $installKitPath/paradiseo-eo/build" "[$currentStepCounter-2] Go in Paradiseo-EO build dir" $SPY
|
||||
RETURN=`expr $RETURN + $?`
|
||||
|
||||
execute_cmd " echo \"cmake ../ -G$BUILD_PROCESS_TYPE $MIN_CMAKE_FLAGS $OPTIONNAL_CMAKE_FLAGS\" " "[$currentStepCounter-3] Run CMake using generator $BUILD_PROCESS_TYPE" $SPY
|
||||
|
||||
cmake ../ -G"$BUILD_PROCESS_TYPE" -DCMAKE_BUILD_TYPE=$BUILD_TYPE $MIN_CMAKE_FLAGS $OPTIONNAL_CMAKE_FLAGS >> ${SPY} 2>> ${SPY}
|
||||
RETURN=`expr $RETURN + $?`
|
||||
|
||||
if [ "$COMPILE_PARADISEO" = "1" ]
|
||||
then
|
||||
execute_cmd "ctest $CTEST_CONFIG" "[$currentStepCounter-4] Compile ParadisEO-EO using CTest" $SPY
|
||||
LAST_RETURN=$?
|
||||
# don't consider a submission error as a "right error"
|
||||
if [ ! "$LAST_RETURN" = "$DART_SUBMISSION_ERROR" ]
|
||||
then
|
||||
RETURN=`expr $RETURN + $LAST_RETURN`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! $(($RETURN)) = 0 ]
|
||||
then
|
||||
echo ''
|
||||
echo " --> Error when installing Paradiseo-EO"
|
||||
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
|
||||
return $EO_INSTALL_ERROR
|
||||
else
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
|
||||
echo
|
||||
return $SUCCESSFUL_STEP
|
||||
fi
|
||||
;;
|
||||
$S_INSTALL_MO)
|
||||
########## installing paradiseo-mo ##########
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
|
||||
echo ' --> Installing Paradiseo-MO. Please wait ...'
|
||||
|
||||
if [ ! "$installKitPath" = "$resourceKitPath" ]
|
||||
then
|
||||
cp -Rf $resourceKitPath/paradiseo-mo/ $installKitPath/
|
||||
cp $resourceKitPath/install.cmake $installKitPath/
|
||||
rm -Rf $installKitPath/paradiseo-mo/build/*
|
||||
fi
|
||||
|
||||
execute_cmd "cd $installKitPath/paradiseo-mo/build" "[$currentStepCounter-1] Go in Paradiseo-MO dir" $SPY
|
||||
RETURN=$?
|
||||
|
||||
execute_cmd " echo \"cmake ../ -Dconfig=$installKitPath/$CMAKE_PRIMARY_CONFIG_FILE -G\"$BUILD_PROCESS_TYPE\" $MIN_CMAKE_FLAGS $OPTIONNAL_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE\" " "[$currentStepCounter-2] Run CMake using generator $BUILD_PROCESS_TYPE -Dconfig=$installKitPath/$CMAKE_PRIMARY_CONFIG_FILE" $SPY
|
||||
cmake ../ -Dconfig=$installKitPath/$CMAKE_PRIMARY_CONFIG_FILE -G"$BUILD_PROCESS_TYPE" -DCMAKE_BUILD_TYPE=$BUILD_TYPE $MIN_CMAKE_FLAGS $OPTIONNAL_CMAKE_FLAGS>> ${SPY} 2>> ${SPY}
|
||||
RETURN=`expr $RETURN + $?`
|
||||
|
||||
if [ "$COMPILE_PARADISEO" = "1" ]
|
||||
then
|
||||
execute_cmd "ctest $CTEST_CONFIG" "[$currentStepCounter-3] Compile ParadisEO-MO using CTest" $SPY
|
||||
LAST_RETURN=$?
|
||||
# don't consider a submission error as a "right error"
|
||||
if [ ! "$LAST_RETURN" = "$DART_SUBMISSION_ERROR" ]
|
||||
then
|
||||
RETURN=`expr $RETURN + $LAST_RETURN`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! $(($RETURN)) = 0 ]
|
||||
then
|
||||
echo ''
|
||||
echo " --> Error when installing Paradiseo-MO"
|
||||
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
|
||||
return $MO_INSTALL_ERROR
|
||||
else
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
|
||||
echo
|
||||
return $SUCCESSFUL_STEP
|
||||
fi
|
||||
;;
|
||||
|
||||
$S_INSTALL_CUDA)
|
||||
########## installing cudaToolkit 3.2##########
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
|
||||
echo ' --> installing cudaToolkit (required for ParadisEO-GPU) ...'
|
||||
execute_cmd "cd $installKitPath/downloads/" "[$currentStepCounter-2] Go in downloads dir" $SPY
|
||||
sudo ./cudatoolkit_3.2.16_linux_32_ubuntu10.04.run
|
||||
RETURN=$?
|
||||
if [ ! "$?" = "0" ]
|
||||
then
|
||||
echo ''
|
||||
echo " --> Error when installing cudaToolkit"
|
||||
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
|
||||
return $CUDA_INSTALLING_ERROR
|
||||
else
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
|
||||
echo
|
||||
return $SUCCESSFUL_STEP
|
||||
fi
|
||||
kill $?;;
|
||||
|
||||
$S_INSTALL_GPU)
|
||||
########## installing paradiseo-gpu ##########
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
|
||||
echo ' --> Installing Paradiseo-GPU. Please wait ...'
|
||||
|
||||
if [ ! "$installKitPath" = "$resourceKitPath" ]
|
||||
then
|
||||
cp -Rf $resourceKitPath/paradiseo-gpu/ $installKitPath/
|
||||
cp $resourceKitPath/install.cmake $installKitPath/
|
||||
rm -Rf $installKitPath/paradiseo-gpu/build/*
|
||||
fi
|
||||
|
||||
execute_cmd "cd $installKitPath/paradiseo-gpu/build" "[$currentStepCounter-1] Go in Paradiseo-GPU dir" $SPY
|
||||
RETURN=$?
|
||||
|
||||
execute_cmd " echo \"cmake ../ -G\"$BUILD_PROCESS_TYPE\" $MIN_CMAKE_FLAGS $OPTIONNAL_CMAKE_FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE\" " "[$currentStepCounter-2] Run CMake using generator $BUILD_PROCESS_TYPE" $SPY
|
||||
cmake ../ -Dconfig=$installKitPath/$CMAKE_PRIMARY_CONFIG_FILE -G"$BUILD_PROCESS_TYPE" -DCMAKE_BUILD_TYPE=$BUILD_TYPE $MIN_CMAKE_FLAGS $OPTIONNAL_CMAKE_FLAGS>> ${SPY} 2>> ${SPY}
|
||||
RETURN=`expr $RETURN + $?`
|
||||
|
||||
if [ "$COMPILE_PARADISEO" = "1" ]
|
||||
then
|
||||
execute_cmd "ctest $CTEST_CONFIG" "[$currentStepCounter-3] Compile ParadisEO-GPU using CTest" $SPY
|
||||
LAST_RETURN=$?
|
||||
# don't consider a submission error as a "right error"
|
||||
if [ ! "$LAST_RETURN" = "$DART_SUBMISSION_ERROR" ]
|
||||
then
|
||||
RETURN=`expr $RETURN + $LAST_RETURN`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! $(($RETURN)) = 0 ]
|
||||
then
|
||||
echo ''
|
||||
echo " --> Error when installing Paradiseo-GPU"
|
||||
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
|
||||
return $GPU_INSTALL_ERROR
|
||||
else
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
|
||||
echo
|
||||
return $SUCCESSFUL_STEP
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
$S_REMOVE_INSTALL)
|
||||
########## removing a previous install of EO ##########
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter \033[0m "
|
||||
echo ' --> Removing your previous install of ParadisEO-GPU ...'
|
||||
|
||||
execute_cmd "rm -Rf $installKitPath/paradiseo-eo/build/*" "[$currentStepCounter] Remove $installKitPath/paradiseo-eo/build/*" $SPY
|
||||
idx=$?
|
||||
execute_cmd "rm -Rf $installKitPath/paradiseo-mo/build/*" "[$currentStepCounter] Remove $installKitPath/paradiseo-mo/build/*" $SPY
|
||||
idx=`expr $idx + $?`
|
||||
execute_cmd "rm -Rf $installKitPath/paradiseo-gpu/build/*" "[$currentStepCounter] Remove $installKitPath/paradiseo-gpu/build/*" $SPY
|
||||
idx=`expr $idx + $?`
|
||||
|
||||
if [ ! $(($idx)) = 0 ]
|
||||
then
|
||||
echo ''
|
||||
echo " --> Error when removing previous install of ParadisEO"
|
||||
echo -e ' \033[40m\033[1;33m### END ### \033[0m '
|
||||
return $RM_UTIL_ERROR
|
||||
else
|
||||
echo -e " \033[40m\033[1;34m# STEP $currentStepCounter OK \033[0m"
|
||||
echo -e "Please \033[40m\033[1;33m CLOSE YOUR TERMINAL OR OPEN A NEW ONE \033[0m before proceeding with a new installation."
|
||||
echo
|
||||
return $SUCCESSFUL_STEP
|
||||
fi
|
||||
;;
|
||||
|
||||
$S_END)
|
||||
echo
|
||||
echo
|
||||
echo -e " \033[40m\033[1;34m# SUCCESSFULL INSTALLATION. \033[0m"
|
||||
echo
|
||||
return $SUCCESSFUL_STEP
|
||||
;;
|
||||
*)
|
||||
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
########################################################
|
||||
######### BODY ########
|
||||
#########################################################
|
||||
|
||||
|
||||
(cmake --version) < /dev/null > /dev/null 2>&1 ||
|
||||
{
|
||||
echo "You must have CMake installed to compile $PROG. Please update your system to get it before installing $PROG."
|
||||
execute_cmd "echo \"You must have CMake installed to compile $PROG. Please update your system to get it before installing $PROG.\"" "[0-3] Check autoconf" $SPY
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if [ "$DIE" = "1" ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
########################################################################
|
||||
# Simple menu
|
||||
# The options are :
|
||||
# --prefix
|
||||
# --debug
|
||||
# --skipdart
|
||||
# --help
|
||||
#######################################################################
|
||||
|
||||
INSTALL_TREATENED=0
|
||||
INSTALL_PATH=$PWD
|
||||
for i in $*
|
||||
do
|
||||
if [ "${i%=*}" = "--help" ] || [ "${i%=*}" = "-h" ]
|
||||
then
|
||||
clear
|
||||
echo "installParadiseo-gpu.sh"
|
||||
echo
|
||||
echo -e "\033[1mNAME\033[0m"
|
||||
echo ' installParadiseo-gpu.sh - Install ParadisEO-GPU'
|
||||
echo
|
||||
echo -e "\033[1mSYNOPSIS\033[0m"
|
||||
echo -e ' \033[1m./installParadiseo-gpu.sh\033[0m or \033[1mbash installParadiseo-gpu.sh\033[0m'
|
||||
echo -e ' [\033[1m--prefix=\033[0m\033[4mPATH\033[0m] [\033[1m--debug\033[0m] [\033[1m--skipdart\033[0m] [\033[1m--home=\033[0m\033[4mHOME\033[0m] [\033[1m-h\033[0m] [\033[1m--help\033[0m]'
|
||||
echo
|
||||
echo -e "\033[1mDESCRIPTION\033[0m"
|
||||
echo -e " \033[1m--prefix=\033[0m\033[4mPATH\033[0m"
|
||||
echo -e " ParadisEO-GPU will be installed in the directory \033[0m\033[4mPATH\033[0m. The current directory is used by default."
|
||||
echo
|
||||
echo -e " \033[1m--debug\033[0m"
|
||||
echo ' Debug mode, set warning compiler flags and run tests.'
|
||||
echo
|
||||
echo -e " \033[1m--skipdart\033[0m"
|
||||
echo ' Use this option to avoid build/test report submission to our Dart server.'
|
||||
echo
|
||||
echo -e " \033[1m--home=\033[0m\033[4mHOME\033[0m"
|
||||
echo -e " Using \033[0m\033[4mHOME\033[0m as your home directory. Should be used when ~ doesnt reference your home. "
|
||||
echo
|
||||
echo -e " \033[1m-h, --help\033[0m"
|
||||
echo ' Print these useful lines.'
|
||||
echo
|
||||
echo -e "\033[1mAUTHOR\033[0m"
|
||||
echo " Written by Karima Boufaras."
|
||||
echo
|
||||
echo -e "\033[1mBUGS\033[0m"
|
||||
echo " Report bugs to paradiseo-bugs@lists.gforge.inria.fr."
|
||||
echo
|
||||
echo -e "\033[1mCOPYRIGHT\033[0m"
|
||||
echo " This software is governed by the CeCILL license under French law and"
|
||||
echo " abiding by the rules of distribution of free software. You can use,"
|
||||
echo " modify and/ or redistribute the software under the terms of the CeCILL"
|
||||
echo " license as circulated by CEA, CNRS and INRIA at the following URL"
|
||||
echo " http://www.cecill.info. "
|
||||
echo
|
||||
echo -e "\033[1mSEE ALSO\033[0m"
|
||||
echo " For further help, please contact paradiseo-help@lists.gforge.inria.fr."
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
if [ "${i%=*}" = "--prefix" ]
|
||||
then
|
||||
INSTALL_PATH=${i#*=}
|
||||
fi
|
||||
if [ "${i%=*}" = "--debug" ]
|
||||
then
|
||||
BUILD_TYPE=Debug
|
||||
OPTIONNAL_CMAKE_FLAGS='-DENABLE_CMAKE_TESTING=TRUE'
|
||||
CTEST_CONFIG="$CTEST_CONFIG -D ExperimentalTest"
|
||||
fi
|
||||
if [ "${i%=*}" = "--skipdart" ]
|
||||
then
|
||||
SKIP_DART="1"
|
||||
fi
|
||||
if [ "${i%=*}" = "--home" ]
|
||||
then
|
||||
HOME_PATH=${i#*=}
|
||||
fi
|
||||
done
|
||||
#######################################################################
|
||||
|
||||
### Do we have a valid home path ?
|
||||
if [ ! -d $HOME_PATH ]
|
||||
then
|
||||
echo " Please give a valid path for your home directory (use --help for further information)"
|
||||
fi
|
||||
|
||||
|
||||
### Add a CTest flag depending on the "skipdart" option.
|
||||
if [ ! "$SKIP_DART" = "1" ]
|
||||
then
|
||||
CTEST_CONFIG="$CTEST_CONFIG -D ExperimentalSubmit"
|
||||
fi
|
||||
|
||||
### Need the generator
|
||||
BUILD_PROCESS_TYPE="$G_UNIX_MAKEFILES"
|
||||
GENERATOR_TREATENED=1
|
||||
while [ ! "$INSTALL_TREATENED" = "1" ]
|
||||
do
|
||||
case "$INSTALL_TYPE" in
|
||||
|
||||
$P_FULL_INSTALL)
|
||||
counter=0
|
||||
for step in $FULL_INSTALL
|
||||
do
|
||||
run_install_step $INSTALL_PATH $step $counter
|
||||
on_error $?
|
||||
counter=`expr $counter + 1`
|
||||
done
|
||||
INSTALL_TREATENED=1
|
||||
;;
|
||||
|
||||
$P_RM_PREVIOUS_INSTALLL)
|
||||
counter=0
|
||||
for step in $RM_PREVIOUS_INSTALL
|
||||
do
|
||||
run_install_step $INSTALL_PATH $step $counter
|
||||
on_error $?
|
||||
counter=`expr $counter + 1`
|
||||
done
|
||||
INSTALL_TREATENED=1
|
||||
;;
|
||||
|
||||
$P_EXIT_INSTALL)
|
||||
INSTALL_TREATENED=1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo
|
||||
echo -e ' \033[40m\033[1;33m### Please select your install for ParadisEO : ### \033[0m '
|
||||
echo
|
||||
echo " 1 : Full install (all the components : EO,MO and GPU)"
|
||||
echo " 2 : Remove a previous install of ParadisEO located in $INSTALL_PATH"
|
||||
echo " 3 : Exit install"
|
||||
read INSTALL_TYPE
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
Authors:
|
||||
Boufaras Karima
|
||||
Thé Van Luong
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,79 +0,0 @@
|
|||
# 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")
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
# 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()
|
||||
|
||||
|
||||
|
|
@ -1,280 +0,0 @@
|
|||
# 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 )
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
######################################################################################
|
||||
### 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)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
"test/"
|
||||
"paradiseo-eo/"
|
||||
"paradiseo-mo/"
|
||||
"paradiseo-gpu/"
|
||||
"problems/"
|
||||
)
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
##########################################################################################
|
||||
### 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)
|
||||
|
||||
##########################################################################################
|
||||
|
|
@ -1,275 +0,0 @@
|
|||
# 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
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/** @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
|
||||
*/
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
#######################################################################################
|
||||
### 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)
|
||||
|
||||
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,200 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
/*
|
||||
<moGPUEvalByModif.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 __moGPUEvalByModif_H
|
||||
#define __moGPUEvalByModif_H
|
||||
|
||||
#include <eval/moGPUKernelEvalByModif.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
#include <performance/moGPUTimer.h>
|
||||
|
||||
/**
|
||||
* class for the parallel evaluation of neighborhood
|
||||
*/
|
||||
|
||||
template<class Neighbor, class Eval>
|
||||
class moGPUEvalByModif: 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 the incremental evaluation
|
||||
*/
|
||||
|
||||
moGPUEvalByModif(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
|
||||
moGPUKernelEvalByModif<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 Modif set cpySolution to false"
|
||||
<< 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();
|
||||
moGPUKernelEvalByModif<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();
|
||||
moGPUKernelEvalByModif<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();
|
||||
moGPUKernelEvalByModif<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
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
<moGPUEvalFunc.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 __moGPUEvalFunc_H
|
||||
#define __moGPUEvalFunc_H
|
||||
|
||||
/**
|
||||
* Abstract class for GPU evaluation of neighbor
|
||||
*/
|
||||
|
||||
template<class Neighbor>
|
||||
class moGPUEvalFunc {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename EOT::ElemType T;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUEvalFunc() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
virtual ~moGPUEvalFunc() {
|
||||
}
|
||||
|
||||
/**
|
||||
*Virtual functor to compute fitness of a solution neighbor
|
||||
*@param _solution the solution which generate the neighborhood
|
||||
*@param _fitness the current solution fitness
|
||||
*@param _index an array that contains a set of indexes corresponding to the current thread identifier neighbor
|
||||
* the last element of this array contains neighborhood size
|
||||
*/
|
||||
|
||||
virtual inline __host__ __device__ Fitness operator() (T * _solution,Fitness _fitness, unsigned int * _index) {
|
||||
|
||||
return _fitness;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
<moGPUKernelEvalByCpy.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 __moGPUKernelEvalByCpy_H
|
||||
#define __moGPUKernelEvalByCpy_H
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The kernel function called from the host and executed in device to compute all neighbors fitness at one time
|
||||
* without mapping, each thread id compute one fitness by copying localy the solution
|
||||
* @param _eval how to evaluate each neighbor
|
||||
* @param _solution the representation of solution( vector of int,float....)
|
||||
* @param _allFitness the array of Fitness to save all neighbors fitness
|
||||
* @param _fitness the current solution fitness
|
||||
* @param _neighborhoodsize the size of the neighborhood
|
||||
*/
|
||||
|
||||
template<class T, class Fitness, class Eval>
|
||||
|
||||
__global__ void moGPUKernelEvalByCpy(Eval _eval, T * _solution, Fitness* _allFitness,
|
||||
Fitness _fitness, unsigned _neighborhoodsize) {
|
||||
|
||||
// The thread identifier within a grid block's
|
||||
int id = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
// array to save index to be changed
|
||||
unsigned index[2];
|
||||
T sol_tmp[SIZE];
|
||||
// In this representation each id identify one and only one neighbor in neighborhood
|
||||
if (id < _neighborhoodsize) {
|
||||
for(unsigned i=0;i<SIZE;i++)
|
||||
sol_tmp[i]=_solution[i];
|
||||
//Change the id'th element of solution
|
||||
index[0]=id;
|
||||
index[1]=_neighborhoodsize;
|
||||
//Compute fitness for id'th neighbor
|
||||
_allFitness[id] = _eval(sol_tmp,_fitness,index);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
<moGPUKernelEvalByModif.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 __moGPUKernelEvalByModif_H
|
||||
#define __moGPUKernelEvalByModif_H
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The kernel function called from the host and executed in device to compute all neighbors fitness at one time
|
||||
* without mapping, each thread id compute one fitness by modif of solution
|
||||
* @param _eval how to evaluate each neighbor
|
||||
* @param _solution the representation of solution( vector of int,float....)
|
||||
* @param _allFitness the array of Fitness to save all neighbors fitness
|
||||
* @param _fitness the current solution fitness
|
||||
* @param _neighborhoodsize the size of the neighborhood
|
||||
*/
|
||||
|
||||
template<class T, class Fitness, class Eval>
|
||||
|
||||
__global__ void moGPUKernelEvalByModif(Eval _eval, T * _solution, Fitness* _allFitness,
|
||||
Fitness _fitness, unsigned _neighborhoodsize) {
|
||||
|
||||
// The thread identifier within a grid block's
|
||||
int id = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
// array to save index to be changed
|
||||
unsigned index[2];
|
||||
// In this representation each id identify one and only one neighbor in neighborhood
|
||||
if (id < _neighborhoodsize) {
|
||||
//Change the id'th element of solution
|
||||
index[0]=id;
|
||||
index[1]=_neighborhoodsize;
|
||||
//Compute fitness for id'th neighbor
|
||||
_allFitness[id] = _eval(_solution,_fitness,index);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,202 +0,0 @@
|
|||
/*
|
||||
<moGPUMappingEvalByCpy.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 __moGPUMappingEvalByCpy_H
|
||||
#define __moGPUMappingEvalByCpy_H
|
||||
#include <eval/moGPUEval.h>
|
||||
#include <eval/moGPUMappingKernelEvalByCpy.h>
|
||||
#include <performance/moGPUTimer.h>
|
||||
|
||||
/**
|
||||
* class for the Mapping neighborhood evaluation
|
||||
*/
|
||||
|
||||
template<class Neighbor, class Eval>
|
||||
class moGPUMappingEvalByCpy: public moGPUEval<Neighbor> {
|
||||
|
||||
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 moGPUEval<Neighbor>::neighborhoodSize;
|
||||
using moGPUEval<Neighbor>::host_FitnessArray;
|
||||
using moGPUEval<Neighbor>::device_FitnessArray;
|
||||
using moGPUEval<Neighbor>::device_solution;
|
||||
using moGPUEval<Neighbor>::NEW_BLOCK_SIZE;
|
||||
using moGPUEval<Neighbor>::NEW_kernel_Dim;
|
||||
using moGPUEval<Neighbor>::mutex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval how to evaluate a neighbor
|
||||
*/
|
||||
|
||||
moGPUMappingEvalByCpy(unsigned int _neighborhoodSize, Eval & _eval) :
|
||||
moGPUEval<Neighbor> (_neighborhoodSize), eval(_eval) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moGPUMappingEvalByCpy() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute fitness for all solution neighbors in device with associated mapping
|
||||
* @param _sol the solution that generate the neighborhood to evaluate parallely
|
||||
* @param _mapping the array of mapping indexes that associate a neighbor identifier to X-position
|
||||
* @param _cpySolution Launch kernel with local copy option of solution in each thread if it's set to true
|
||||
* @param _withCalibration an automatic kernel configuration, fix nbr of thread by block and nbr of grid by kernel
|
||||
*/
|
||||
|
||||
void neighborhoodEval(EOT & _sol, unsigned int * _mapping,
|
||||
bool _cpySolution, bool _withCalibration) {
|
||||
if (_cpySolution) {
|
||||
unsigned size = _sol.size();
|
||||
// Get Current solution fitness
|
||||
Fitness fitness = _sol.fitness();
|
||||
if (!mutex) {
|
||||
//Allocate the space for solution in the device global memory
|
||||
cudaMalloc((void**) &device_solution.vect, size * sizeof(T));
|
||||
if (_withCalibration)
|
||||
calibration(_sol, _mapping);
|
||||
mutex = true;
|
||||
}
|
||||
//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,using a given mapping
|
||||
moGPUMappingKernelEvalByCpy<T,Fitness,Eval><<<NEW_kernel_Dim,NEW_BLOCK_SIZE >>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,neighborhoodSize);
|
||||
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
|
||||
* @param _mapping the array of mapping indexes that associate a neighbor identifier to X-position
|
||||
*/
|
||||
|
||||
virtual void calibration(EOT & _sol, unsigned int * _mapping) {
|
||||
|
||||
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 = 0;
|
||||
unsigned tmp_kernel_Dim;
|
||||
best_time = RAND_MAX;
|
||||
#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();
|
||||
moGPUMappingKernelEvalByCpy<T,Fitness,Eval><<<tmp_kernel_Dim,NB_THREAD[i]>>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,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();
|
||||
moGPUMappingKernelEvalByCpy<T,Fitness,Eval><<<tmp_kernel_Dim,BLOCK_SIZE>>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,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();
|
||||
moGPUMappingKernelEvalByCpy<T,Fitness,Eval><<<tmp_kernel_Dim,NB_THREAD[i]>>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,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
|
||||
|
|
@ -1,200 +0,0 @@
|
|||
/*
|
||||
<moGPUMappingEvalByModif.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 __moGPUMappingEvalByModif_H
|
||||
#define __moGPUMappingEvalByModif_H
|
||||
#include <eval/moGPUEval.h>
|
||||
#include <eval/moGPUMappingKernelEvalByModif.h>
|
||||
#include <performance/moGPUTimer.h>
|
||||
|
||||
/**
|
||||
* class for the Mapping neighborhood evaluation
|
||||
*/
|
||||
|
||||
template<class Neighbor, class Eval>
|
||||
class moGPUMappingEvalByModif: public moGPUEval<Neighbor> {
|
||||
|
||||
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 moGPUEval<Neighbor>::neighborhoodSize;
|
||||
using moGPUEval<Neighbor>::host_FitnessArray;
|
||||
using moGPUEval<Neighbor>::device_FitnessArray;
|
||||
using moGPUEval<Neighbor>::device_solution;
|
||||
using moGPUEval<Neighbor>::NEW_BLOCK_SIZE;
|
||||
using moGPUEval<Neighbor>::NEW_kernel_Dim;
|
||||
using moGPUEval<Neighbor>::mutex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval the incremental evaluation
|
||||
*/
|
||||
|
||||
moGPUMappingEvalByModif(unsigned int _neighborhoodSize, Eval & _eval) :
|
||||
moGPUEval<Neighbor> (_neighborhoodSize), eval(_eval) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moGPUMappingEvalByModif() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute fitness for all solution neighbors in device with associated mapping
|
||||
* @param _sol the solution that generate the neighborhood to evaluate parallely
|
||||
* @param _mapping the array of mapping indexes that associate a neighbor identifier to X-position
|
||||
* @param _cpySolution Launch kernel with local copy option of solution in each thread if it's set to true
|
||||
* @param _withCalibration an automatic kernel configuration, fix nbr of thread by block and nbr of grid by kernel
|
||||
*/
|
||||
|
||||
void neighborhoodEval(EOT & _sol, unsigned int * _mapping,
|
||||
bool _cpySolution, bool _withCalibration) {
|
||||
if (!_cpySolution) {
|
||||
unsigned size = _sol.size();
|
||||
// Get Current solution fitness
|
||||
Fitness fitness = _sol.fitness();
|
||||
if (!mutex) {
|
||||
//Allocate the space for solution in the device global memory
|
||||
cudaMalloc((void**) &device_solution.vect, size * sizeof(T));
|
||||
if (_withCalibration)
|
||||
calibration(_sol, _mapping);
|
||||
mutex = true;
|
||||
}
|
||||
//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,using a given mapping
|
||||
moGPUMappingKernelEvalByModif<T,Fitness,Eval><<<NEW_kernel_Dim,NEW_BLOCK_SIZE >>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,neighborhoodSize);
|
||||
cudaMemcpy(host_FitnessArray, device_FitnessArray, neighborhoodSize
|
||||
* sizeof(Fitness), cudaMemcpyDeviceToHost);
|
||||
} else
|
||||
cout << "It's evaluation by Modif set cpySolution to false" << 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
|
||||
* @param _mapping the array of mapping indexes that associate a neighbor identifier to X-position
|
||||
*/
|
||||
|
||||
|
||||
virtual void calibration(EOT & _sol, unsigned int * _mapping) {
|
||||
|
||||
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 = 0;
|
||||
unsigned tmp_kernel_Dim;
|
||||
best_time = RAND_MAX;
|
||||
#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();
|
||||
moGPUMappingKernelEvalByModif<T,Fitness,Eval><<<tmp_kernel_Dim,NB_THREAD[i]>>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,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();
|
||||
moGPUMappingKernelEvalByModif<T,Fitness,Eval><<<tmp_kernel_Dim,NEW_BLOCK_SIZE >>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,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();
|
||||
moGPUMappingKernelEvalByModif<T,Fitness,Eval><<<tmp_kernel_Dim,NB_THREAD[i] >>>(eval,device_solution.vect,device_FitnessArray,fitness,_mapping,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
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
<moGPUMappingKernelEvalByCpy.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 __moGPUMappingKernelEvalByCpy_H
|
||||
#define __moGPUMappingKernelEvalByCpy_H
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The kernel function called from the host and executed in device to compute all neighbors fitness at one time
|
||||
* without mapping, each thread id compute one fitness by modif of solution
|
||||
* @param _eval how to evaluate each neighbor
|
||||
* @param _solution the representation of solution( vector of int,float....)
|
||||
* @param _allFitness the array of Fitness to save all neighbors fitness
|
||||
* @param _fitness the current solution fitness
|
||||
* @param _mapping associate to each threadID a set of correspondent indexes
|
||||
* @param _neighborhoodsize the size of the neighborhood
|
||||
*/
|
||||
|
||||
template<class T, class Fitness, class Eval>
|
||||
|
||||
__global__ void moGPUMappingKernelEvalByCpy(Eval _eval, T * _solution, Fitness* _allFitness,
|
||||
Fitness _fitness,unsigned * _mapping,unsigned _neighborhoodsize) {
|
||||
|
||||
// The thread identifier within a grid block's
|
||||
int id = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
//counter of number of x-change
|
||||
unsigned i;
|
||||
// array to save set a set of indexes corresponding to the current thread identifier
|
||||
unsigned index[NB_POS+2];
|
||||
T sol_tmp[SIZE];
|
||||
// In this representation each id identify one and only one neighbor in neighborhood
|
||||
if (id < _neighborhoodsize) {
|
||||
for(i=0;i<SIZE;i++)
|
||||
sol_tmp[i]=_solution[i];
|
||||
for(i=0;i<NB_POS;i++)
|
||||
index[i]=_mapping[id + i * _neighborhoodsize];
|
||||
index[NB_POS]=_neighborhoodsize;
|
||||
index[NB_POS+1]=id;
|
||||
//Evaluate by Modif Id'th neighbor with index mapping
|
||||
_allFitness[id]=_eval(sol_tmp,_fitness, index);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
<moGPUMappingKernelEvalByModif.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 __moGPUMappingKernelEvalByModif_H
|
||||
#define __moGPUMappingKernelEvalByModif_H
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The kernel function called from the host and executed in device to compute all neighbors fitness at one time
|
||||
* without mapping, each thread id compute one fitness by modif of solution
|
||||
* @param _eval how to evaluate each neighbor
|
||||
* @param _solution the representation of solution( vector of int,float....)
|
||||
* @param _allFitness the array of Fitness to save all neighbors fitness
|
||||
* @param _fitness the current solution fitness
|
||||
* @param _mapping associate to each threadID a set of correspondent indexes
|
||||
* @param _neighborhoodsize the size of the neighborhood
|
||||
*/
|
||||
|
||||
template<class T, class Fitness, class Eval>
|
||||
|
||||
__global__ void moGPUMappingKernelEvalByModif(Eval _eval, T * _solution, Fitness* _allFitness,
|
||||
Fitness _fitness,unsigned int * _mapping,unsigned _neighborhoodsize) {
|
||||
|
||||
// The thread identifier within a grid block's
|
||||
int id = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
//counter of number of x-change
|
||||
unsigned i;
|
||||
// array to save set a set of indexes corresponding to the current thread identifier
|
||||
unsigned index[NB_POS+2];
|
||||
// In this representation each id identify one and only one neighbor in neighborhood
|
||||
if (id < _neighborhoodsize) {
|
||||
for(i=0;i<NB_POS;i++)
|
||||
index[i]=_mapping[id + i * _neighborhoodsize];
|
||||
index[NB_POS]=_neighborhoodsize;
|
||||
index[NB_POS+1]=id;
|
||||
//Evaluate by Modif Id'th neighbor with index mapping
|
||||
_allFitness[id]=_eval(_solution,_fitness, index);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
<moGPUAllocator.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 __moGPUAllocator_H_
|
||||
#define __moGPUAllocator_H_
|
||||
|
||||
/**
|
||||
* class for allocation data on GPU global memory
|
||||
*/
|
||||
|
||||
class moGPUAllocator {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUAllocator() {
|
||||
}
|
||||
|
||||
/**
|
||||
*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
|
||||
*/
|
||||
template<typename T>
|
||||
void operator()(T* & _data, unsigned _dataSize) {
|
||||
|
||||
//Allocate data in GPU memory
|
||||
cudaMalloc((void**) &_data, _dataSize * sizeof(T));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUAllocator() {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
<moGPUCopy.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 __moGPUCopy_H_
|
||||
#define __moGPUCopy_H_
|
||||
|
||||
/**
|
||||
* class to copy data from CPU memory to GPU global memory and vice versa
|
||||
*/
|
||||
|
||||
class moGPUCopy {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUCopy() {
|
||||
}
|
||||
|
||||
/**
|
||||
*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
|
||||
*/
|
||||
template<typename T>
|
||||
void operator()(T* & _data, T * & _dataTocpy, unsigned _dataSize) {
|
||||
|
||||
//copy data from CPU memory to GPU memory
|
||||
cudaMemcpy(_data, _dataTocpy, _dataSize * sizeof(T),
|
||||
cudaMemcpyHostToDevice);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*Copy device data from GPU global memory to global variable declared in device
|
||||
*@param _dev_data the device global variable
|
||||
*@param _dataTocpy the data to copy GPU global memory to GPU global variable
|
||||
*/
|
||||
template<typename T>
|
||||
void operator()(T* & _dev_data, T * & _dataTocpy) {
|
||||
|
||||
//Copy n bytes from the memory area pointed to by _dataTocpy to the memory area pointed to by offset bytes from the start of symbol _dev_data
|
||||
|
||||
cudaMemcpyToSymbol(_dev_data, &_dataTocpy, sizeof(_dataTocpy));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*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)
|
||||
*/
|
||||
template<typename T>
|
||||
void operator()(T* & _data, T * & _dataTocpy, unsigned _dataSize,
|
||||
bool _HostToDevice) {
|
||||
|
||||
if (_HostToDevice) {
|
||||
|
||||
//copy data from CPU memory to GPU global memory
|
||||
cudaMemcpy(_data, _dataTocpy, _dataSize * sizeof(T),
|
||||
cudaMemcpyHostToDevice);
|
||||
}
|
||||
|
||||
else {
|
||||
//copy data from GPU global memory to GPU memory
|
||||
cudaMemcpy(_data, _dataTocpy, _dataSize * sizeof(T),
|
||||
cudaMemcpyDeviceToHost);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
~moGPUCopy() {
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
<moGPUDeallocator.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 __moGPUDeallocator_H_
|
||||
#define __moGPUDeallocator_H_
|
||||
|
||||
/**
|
||||
* class for Deallocation of data from GPU global memory
|
||||
*/
|
||||
|
||||
class moGPUDeallocator {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUDeallocator() {
|
||||
}
|
||||
|
||||
/**
|
||||
*Deallocate data on GPU global memory
|
||||
*@param _data the data to deallocate from GPU global memory
|
||||
*/
|
||||
template<typename T>
|
||||
void operator()(T* & _data) {
|
||||
|
||||
//Deallocate data from GPU global memory
|
||||
cudaFree(_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUDeallocator() {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<moGPUObject.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 __moGPUObject_H_
|
||||
#define __moGPUObject_H_
|
||||
|
||||
#include <memory/moGPUAllocator.h>
|
||||
#include <memory/moGPUDeallocator.h>
|
||||
#include <memory/moGPUCopy.h>
|
||||
|
||||
/**
|
||||
* class of data management on GPU global memory (allocation,deallocation & copy)
|
||||
*/
|
||||
|
||||
class moGPUObject {
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
moGPUObject() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*Allocate & Copy data from CPU memory to GPU global memory (default copy)
|
||||
*@param _data the data to allocate on GPU
|
||||
*@param _dataTocpy the data to copy from CPU memory to _data on GPU memory
|
||||
*@param _dataSize the size of data to copy
|
||||
*/
|
||||
template<typename T>
|
||||
void memCopy(T* & _data, T * & _dataTocpy, unsigned _dataSize) {
|
||||
malloc(_data, _dataSize);
|
||||
copy(_data, _dataTocpy, _dataSize);
|
||||
}
|
||||
|
||||
/**
|
||||
*Copy device data from GPU global memory to global variable declared in device
|
||||
*@param _dev_data the device global variable
|
||||
*@param _dataTocpy the data to copy GPU global memory to GPU global variable
|
||||
*/
|
||||
template<typename T>
|
||||
void memCopyGlobalVariable(T* & _dev_data, T * & _dataTocpy) {
|
||||
copy(_dev_data, _dataTocpy);
|
||||
}
|
||||
|
||||
/**
|
||||
*Deallocate data on GPU global memory
|
||||
*@param _data the data to desallocate from GPU global memory
|
||||
*/
|
||||
template<typename T>
|
||||
void memFree(T* & _data) {
|
||||
free(_data);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
moGPUAllocator malloc;
|
||||
moGPUCopy copy;
|
||||
moGPUDeallocator free;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
<moGPUSpecificData.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 __moGPUSpecificData_H_
|
||||
#define __moGPUSpecificData_H_
|
||||
|
||||
#include <memory/moGPUObject.h>
|
||||
|
||||
/**
|
||||
* class of managment of specific data problem
|
||||
*/
|
||||
|
||||
class moGPUSpecificData {
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
|
||||
moGPUSpecificData() {
|
||||
sizeData = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load data from file given in argument
|
||||
* @param _file the name of data file
|
||||
*/
|
||||
|
||||
virtual void load(char* _file)=0;
|
||||
|
||||
/*
|
||||
* Return the size
|
||||
* @return the size of data to load
|
||||
*/
|
||||
|
||||
virtual unsigned int getSize() {
|
||||
return sizeData;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the size of data to load
|
||||
* @param _size the data size
|
||||
*/
|
||||
|
||||
virtual void setSize(unsigned int _size) {
|
||||
sizeData = _size;
|
||||
}
|
||||
|
||||
public:
|
||||
unsigned int sizeData;
|
||||
moGPUObject GPUObject;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
<moGPUBitNeighbor.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 __moGPUBitNeighbor_h
|
||||
#define __moGPUBitNeighbor_h
|
||||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moIndexNeighbor.h>
|
||||
#include <GPUType/moGPUBitVector.h>
|
||||
|
||||
/**
|
||||
* Neighbor related to a solution vector of Bit
|
||||
*/
|
||||
|
||||
template<class Fitness>
|
||||
class moGPUBitNeighbor: public moBackableNeighbor<moGPUBitVector<Fitness> > ,
|
||||
public moIndexNeighbor<moGPUBitVector<Fitness> > {
|
||||
|
||||
public:
|
||||
|
||||
typedef moGPUBitVector<Fitness> EOT ;
|
||||
using moBackableNeighbor<EOT>::fitness;
|
||||
using moIndexNeighbor<EOT>::key;
|
||||
|
||||
/**
|
||||
* move the solution
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
|
||||
virtual void move(EOT & _solution) {
|
||||
|
||||
_solution[key] = !_solution[key];
|
||||
_solution.invalidate();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* move back the solution (useful for the evaluation by modif)
|
||||
* @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 "moGPUBitNeighbor";
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
<moGPUMapping.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
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 _moGPUMapping_h
|
||||
#define _moGPUMapping_h
|
||||
|
||||
#include <neighborhood/moOrderNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Define a Mapping Neighborhood:
|
||||
*
|
||||
* This neighborhood should manipulate a moGPUXChange Neighbor
|
||||
* It helps to associate to identified neighbor by one index a set of correspondent indexes
|
||||
*/
|
||||
|
||||
template<class N>
|
||||
class moGPUMapping: public moOrderNeighborhood<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moOrderNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moOrderNeighborhood<Neighbor>::currentIndex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of positions to exchange
|
||||
*/
|
||||
|
||||
moGPUMapping(unsigned int _neighborhoodSize, unsigned int _xChange) :
|
||||
moOrderNeighborhood<Neighbor> (_neighborhoodSize), xChange(_xChange) {
|
||||
|
||||
mutex = false;
|
||||
indices = new unsigned int[xChange];
|
||||
mapping = new unsigned int[neighborhoodSize * xChange];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUMapping() {
|
||||
|
||||
delete[] (indices);
|
||||
delete[] (mapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
|
||||
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moOrderNeighborhood<Neighbor>::init(_solution, _current);
|
||||
//Compute the mapping only for the first init
|
||||
if (!mutex) {
|
||||
setMapping(_solution.size());
|
||||
mutex = true;
|
||||
}
|
||||
//get the mapping correspondent to the currentIndex
|
||||
getMapping(currentIndex);
|
||||
if (!(_current.getXChange() == xChange))
|
||||
_current.setXChange(xChange);
|
||||
//associate to this neighbor a set of correspondent indexes
|
||||
_current.setIndices(indices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the next neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the next neighbor
|
||||
*/
|
||||
|
||||
virtual void next(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moOrderNeighborhood<Neighbor>::next(_solution, _current);
|
||||
getMapping(currentIndex);
|
||||
_current.setIndices(indices);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mapping of K-indexes
|
||||
* @param _size the size of the solution
|
||||
*/
|
||||
|
||||
virtual void setMapping(unsigned _size) =0;
|
||||
|
||||
/**
|
||||
* Associate mapping of current index to a set of indexes
|
||||
* _currentIndex the index to map with a set of indexes
|
||||
*/
|
||||
|
||||
virtual void getMapping(unsigned int _currentIndex) {
|
||||
for (unsigned int i = 0; i < xChange; i++) {
|
||||
indices[i] = mapping[_currentIndex + i * neighborhoodSize];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update mapping with combination of indexes corresponding to the currentIndex
|
||||
* @param _indices the set of current combination of indexes
|
||||
* @param _currentIndex the current index corresponding to the current neighbor
|
||||
*/
|
||||
|
||||
virtual void updateMapping(unsigned int* _indices, int _currentIndex) {
|
||||
for (unsigned k = 0; k < xChange; k++)
|
||||
mapping[_currentIndex + k * neighborhoodSize] = _indices[k];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUMapping";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
unsigned int * indices;
|
||||
unsigned int * mapping;
|
||||
unsigned int xChange;
|
||||
bool mutex;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
<moGPUMappingNeighborhood.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 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 __moGPUMappingNeighborhood_h
|
||||
#define __moGPUMappingNeighborhood_h
|
||||
|
||||
#include <neighborhood/moGPUMapping.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
template<class N>
|
||||
class moGPUMappingNeighborhood: public moGPUMapping<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define a Neighbor and type of a solution corresponding
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moGPUMapping<Neighbor>::neighborhoodSize;
|
||||
using moGPUMapping<Neighbor>::currentIndex;
|
||||
using moGPUMapping<Neighbor>::indices;
|
||||
using moGPUMapping<Neighbor>::mapping;
|
||||
using moGPUMapping<Neighbor>::xChange;
|
||||
using moGPUMapping<Neighbor>::mutex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of x-change positions
|
||||
*/
|
||||
|
||||
moGPUMappingNeighborhood(unsigned int _neighborhoodSize,
|
||||
unsigned int _xChange) :
|
||||
moGPUMapping<Neighbor> (_neighborhoodSize, _xChange) {
|
||||
sendMapping = false;
|
||||
cudaMalloc((void**) &device_Mapping, sizeof(unsigned int)
|
||||
* neighborhoodSize * _xChange);
|
||||
}
|
||||
;
|
||||
|
||||
/**
|
||||
*Destructor
|
||||
*/
|
||||
|
||||
~moGPUMappingNeighborhood() {
|
||||
|
||||
cudaFree(device_Mapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood and mapping on device
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
|
||||
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moGPUMapping<Neighbor>::init(_solution, _current);
|
||||
if (!sendMapping) {
|
||||
cudaMemcpy(device_Mapping, mapping,xChange * neighborhoodSize
|
||||
* sizeof(unsigned int), cudaMemcpyHostToDevice);
|
||||
sendMapping = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUMappingNeighborhood";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
bool sendMapping;
|
||||
unsigned int * device_Mapping;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
<moGPUMappingNeighborhoodByCpy.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2012
|
||||
|
||||
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 __moGPUMappingNeighborhoodByCpy_h
|
||||
#define __moGPUMappingNeighborhoodByCpy_h
|
||||
|
||||
#include <neighborhood/moGPUMappingNeighborhood.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
template<class N>
|
||||
class moGPUMappingNeighborhoodByCpy: public moGPUMappingNeighborhood<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define a Neighbor and type of a solution corresponding
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/*A tester*/
|
||||
using moGPUMappingNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moGPUMappingNeighborhood<Neighbor>::currentIndex;
|
||||
using moGPUMappingNeighborhood<Neighbor>::indices;
|
||||
using moGPUMappingNeighborhood<Neighbor>::mapping;
|
||||
using moGPUMappingNeighborhood<Neighbor>::xChange;
|
||||
using moGPUMappingNeighborhood<Neighbor>::mutex;
|
||||
using moGPUMappingNeighborhood<Neighbor>::device_Mapping;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of x-change positions
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
|
||||
moGPUMappingNeighborhoodByCpy(unsigned int _neighborhoodSize,
|
||||
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||
moGPUMappingNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
|
||||
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moGPUMappingNeighborhood<Neighbor>::init(_solution, _current);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution, device_Mapping,1,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUMappingNeighborhoodByCpy";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
moGPUEval<Neighbor>& eval;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
<moGPUMappingNeighborhoodByModif.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 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 __moGPUMappingNeighborhoodByModif_h
|
||||
#define __moGPUMappingNeighborhoodByModif_h
|
||||
|
||||
#include <neighborhood/moGPUMappingNeighborhood.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
template<class N>
|
||||
class moGPUMappingNeighborhoodByModif: public moGPUMappingNeighborhood<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define a Neighbor and type of a solution corresponding
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/*A tester*/
|
||||
using moGPUMappingNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moGPUMappingNeighborhood<Neighbor>::currentIndex;
|
||||
using moGPUMappingNeighborhood<Neighbor>::indices;
|
||||
using moGPUMappingNeighborhood<Neighbor>::mapping;
|
||||
using moGPUMappingNeighborhood<Neighbor>::xChange;
|
||||
using moGPUMappingNeighborhood<Neighbor>::mutex;
|
||||
using moGPUMappingNeighborhood<Neighbor>::device_Mapping;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of x-change positions
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
|
||||
moGPUMappingNeighborhoodByModif(unsigned int _neighborhoodSize,
|
||||
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||
moGPUMappingNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
|
||||
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moGPUMappingNeighborhood<Neighbor>::init(_solution, _current);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution, device_Mapping,0,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUMappingNeighborhoodByModif";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
moGPUEval<Neighbor>& eval;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
<moGPUNeighborhoodSizeUtils.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 _moGPUNeighborhoodSizeUtils_h
|
||||
#define _moGPUNeighborhoodSizeUtils_h
|
||||
|
||||
/**
|
||||
* @return the factorial of an integer
|
||||
* @param _i an integer
|
||||
*/
|
||||
|
||||
static int factorial(int _i) {
|
||||
if (_i == 0)
|
||||
return 1;
|
||||
else
|
||||
return _i * factorial(_i - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the neighborhood Size from the solution size and the exchange distance
|
||||
* @param _n the solution size
|
||||
* @param _xChange the number of positions to change
|
||||
*/
|
||||
|
||||
static int sizeMapping(int _n, unsigned int _xChange) {
|
||||
int _sizeMapping;
|
||||
_sizeMapping = _n;
|
||||
for (int i = _xChange-1; i > 0; i--) {
|
||||
_sizeMapping *= (_n - i);
|
||||
}
|
||||
_sizeMapping /= factorial(_xChange);
|
||||
return _sizeMapping;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<moGPUOrderNeighborhoodByCpy.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 __moGPUOrderNeighborhoodByCpy_h
|
||||
#define __moGPUOrderNeighborhoodByCpy_h
|
||||
|
||||
#include <neighborhood/moOrderNeighborhood.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
/**
|
||||
* An ordered neighborhood with parallel evaluation
|
||||
*/
|
||||
|
||||
template<class N>
|
||||
class moGPUOrderNeighborhoodByCpy: public moOrderNeighborhood<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moOrderNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moOrderNeighborhood<Neighbor>::currentIndex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
|
||||
moGPUOrderNeighborhoodByCpy(unsigned int _neighborhoodSize,
|
||||
moGPUEval<Neighbor>& _eval) :
|
||||
moOrderNeighborhood<Neighbor> (_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<Neighbor>::init(_solution, _neighbor);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution,1,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class name.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUOrderNeighborhoodByCpy";
|
||||
}
|
||||
|
||||
protected:
|
||||
moGPUEval<Neighbor>& eval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<moGPUOrderNeighborhoodByModif.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 __moGPUOrderNeighborhoodByModif_h
|
||||
#define __moGPUOrderNeighborhoodByModif_h
|
||||
|
||||
#include <neighborhood/moOrderNeighborhood.h>
|
||||
#include <eval/moGPUEvalByModif.h>
|
||||
|
||||
/**
|
||||
* An ordered neighborhood with parallel evaluation
|
||||
*/
|
||||
|
||||
template<class N>
|
||||
class moGPUOrderNeighborhoodByModif: public moOrderNeighborhood<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moOrderNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moOrderNeighborhood<Neighbor>::currentIndex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
|
||||
moGPUOrderNeighborhoodByModif(unsigned int _neighborhoodSize,
|
||||
moGPUEval<Neighbor>& _eval) :
|
||||
moOrderNeighborhood<Neighbor> (_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<Neighbor>::init(_solution, _neighbor);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution,0,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class name.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUOrderNeighborhoodByModif";
|
||||
}
|
||||
|
||||
protected:
|
||||
moGPUEval<Neighbor>& eval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
<moGPURndWithReplNeighborhoodByCpy.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 _moGPURndWithReplNeighborhood_h
|
||||
#define _moGPURndWithReplNeighborhood_h
|
||||
|
||||
#include <neighborhood/moRndWithReplNeighborhood.h>
|
||||
#include <eval/moGPUEvalByCpy.h>
|
||||
|
||||
/**
|
||||
* A Random With replacement Neighborhood with parallel evaluation
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moGPURndWithReplNeighborhoodByCpy: public moRndWithReplNeighborhood<Neighbor> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moRndWithReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
moGPURndWithReplNeighborhoodByCpy(unsigned int _neighborhoodSize, moGPUEvalByCpy<
|
||||
Neighbor>& _eval) :
|
||||
moRndWithReplNeighborhood<Neighbor> (_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<Neighbor>::init(_solution, _neighbor);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution,0,0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPURndWithReplNeighborhoodByCpy";
|
||||
}
|
||||
protected:
|
||||
moGPUEvalByCpy<Neighbor>& eval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
<moGPURndWithReplNeighborhoodByModif.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 __moGPURndWithReplNeighborhoodByModif_h
|
||||
#define __moGPURndWithReplNeighborhoodByModif_h
|
||||
|
||||
#include <neighborhood/moRndWithReplNeighborhood.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
/**
|
||||
* A Random With replacement Neighborhood with parallel evaluation
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moGPURndWithReplNeighborhoodByModif: public moRndWithReplNeighborhood<Neighbor> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moRndWithReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
moGPURndWithReplNeighborhoodByModif(unsigned int _neighborhoodSize, moGPUEval<Neighbor>& _eval) :
|
||||
moRndWithReplNeighborhood<Neighbor> (_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<Neighbor>::init(_solution, _neighbor);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution,0,0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPURndWithReplNeighborhood";
|
||||
}
|
||||
protected:
|
||||
moGPUEval<Neighbor>& eval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
<moGPURndWithoutReplNeighborhood.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 __moGPURndWithoutReplNeighborhood_h
|
||||
#define __moGPURndWithoutReplNeighborhood_h
|
||||
|
||||
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
/**
|
||||
* A Random without replacement Neighborhood with parallel evaluation
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moGPURndWithoutReplNeighborhood: public moRndWithoutReplNeighborhood<Neighbor> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moRndWithoutReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moRndWithoutReplNeighborhood<Neighbor>::maxIndex;
|
||||
using moRndWithoutReplNeighborhood<Neighbor>::indexVector;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
|
||||
moGPURndWithoutReplNeighborhood(unsigned int _neighborhoodSize,moGPUEval<
|
||||
Neighbor>& _eval) :
|
||||
moRndWithoutReplNeighborhood<Neighbor> (_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<Neighbor>::init(_solution, _neighbor);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution,0,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPURndWithoutReplNeighborhood";
|
||||
}
|
||||
|
||||
protected:
|
||||
moGPUEval<Neighbor>& eval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
<moGPURndWithoutReplNeighborhood.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 __moGPURndWithoutReplNeighborhood_h
|
||||
#define __moGPURndWithoutReplNeighborhood_h
|
||||
|
||||
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||
#include <eval/moGPUEvalByModif.h>
|
||||
|
||||
/**
|
||||
* A Random without replacement Neighborhood with parallel evaluation
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moGPURndWithoutReplNeighborhood: public moRndWithoutReplNeighborhood<Neighbor> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moRndWithoutReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moRndWithoutReplNeighborhood<Neighbor>::maxIndex;
|
||||
using moRndWithoutReplNeighborhood<Neighbor>::indexVector;
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
moGPURndWithoutReplNeighborhood(unsigned int _neighborhoodSize,moGPUEvalByModif<
|
||||
Neighbor>& _eval) :
|
||||
moRndWithoutReplNeighborhood<Neighbor> (_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<Neighbor>::init(_solution, _neighbor);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution,0,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPURndWithoutReplNeighborhood";
|
||||
}
|
||||
|
||||
protected:
|
||||
moGPUEvalByModif<Neighbor>& eval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
<moGPUXBitFlippingN.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 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 _moGPUXBitFlippingN_h
|
||||
#define _moGPUXBitFlippingN_h
|
||||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moXChangeNeighbor.h>
|
||||
|
||||
/**
|
||||
* X-BitFlipping Neighbor
|
||||
* Neighbor represent different hamming distances,it's fixed by xFlip attribute
|
||||
*/
|
||||
|
||||
template<class EOT, class Fitness = typename EOT::Fitness>
|
||||
class moGPUXBitFlippingN:public moBackableNeighbor<EOT> ,
|
||||
public moXChangeNeighbor<EOT> {
|
||||
public:
|
||||
|
||||
using moXChangeNeighbor<EOT>::indices;
|
||||
using moXChangeNeighbor<EOT>::xChange;
|
||||
using moXChangeNeighbor<EOT>::key;
|
||||
|
||||
/**
|
||||
*Default Constructor
|
||||
*/
|
||||
|
||||
moGPUXBitFlippingN() :
|
||||
moXChangeNeighbor<EOT> () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xFlip the number of bit to flip
|
||||
*/
|
||||
|
||||
moGPUXBitFlippingN(unsigned int _xFlip) :
|
||||
moXChangeNeighbor<EOT> (_xFlip) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the K-Flip in solution
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
|
||||
virtual void move(EOT& _solution) {
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
_solution[indices[i]] = !_solution[indices[i]];
|
||||
_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 "moGPUXBitFlippingN";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
<moGPUXBitFlippingNeighbor.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 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 __moGPUXBitFlippingNeighbor_h
|
||||
#define __moGPUXBitFlippingNeighbor_h
|
||||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moGPUXChangeNeighbor.h>
|
||||
#include <GPUType/moGPUBitVector.h>
|
||||
|
||||
/**
|
||||
* A GPU X-BitFlipping Neighbor
|
||||
*/
|
||||
|
||||
template< class Fitness >
|
||||
class moGPUXBitFlippingNeighbor:public moBackableNeighbor< moGPUBitVector<Fitness> > ,
|
||||
public moGPUXChangeNeighbor< moGPUBitVector<Fitness> > {
|
||||
public:
|
||||
|
||||
typedef moGPUBitVector<Fitness> EOT ;
|
||||
using moGPUXChangeNeighbor<EOT>::indices;
|
||||
using moGPUXChangeNeighbor<EOT>::xChange;
|
||||
using moGPUXChangeNeighbor<EOT>::key;
|
||||
|
||||
/**
|
||||
*Default Constructor
|
||||
*/
|
||||
|
||||
moGPUXBitFlippingNeighbor() :
|
||||
moGPUXChangeNeighbor<EOT> () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xFlip the number of bit to flip
|
||||
*/
|
||||
|
||||
moGPUXBitFlippingNeighbor(unsigned int _xFlip) :
|
||||
moGPUXChangeNeighbor<EOT> (_xFlip) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the K-Flip in solution
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
|
||||
virtual void move(EOT& _solution) {
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
_solution[indices[i]] = !_solution[indices[i]];
|
||||
_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 "moGPUXBitFlippingNeighbor";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
/*
|
||||
<moGPUXChange.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 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 _moGPUXChange_h
|
||||
#define _moGPUXChange_h
|
||||
|
||||
#include <neighborhood/moGPUMapping.h>
|
||||
|
||||
/**
|
||||
* Generalization of exchange and hamming distance based Neighborhood
|
||||
*/
|
||||
|
||||
template<class N>
|
||||
class moGPUXChange: public moGPUMapping<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moGPUMapping<Neighbor>::neighborhoodSize;
|
||||
using moGPUMapping<Neighbor>::currentIndex;
|
||||
using moGPUMapping<Neighbor>::indices;
|
||||
using moGPUMapping<Neighbor>::mapping;
|
||||
using moGPUMapping<Neighbor>::xChange;
|
||||
using moGPUMapping<Neighbor>::mutex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of x-change positions
|
||||
*/
|
||||
|
||||
moGPUXChange(unsigned int _neighborhoodSize, unsigned int _xChange) :
|
||||
moGPUMapping<Neighbor> (_neighborhoodSize, _xChange) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the mapping of K-indexes
|
||||
* @param _size the solution size
|
||||
*/
|
||||
|
||||
void setMapping(unsigned _size) {
|
||||
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
indices[i] = i;
|
||||
|
||||
unsigned int id = 0;
|
||||
bool change = false;
|
||||
|
||||
while (id < neighborhoodSize) {
|
||||
|
||||
while (indices[xChange - 1] < _size) {
|
||||
|
||||
updateMapping(indices, id);
|
||||
indices[(xChange - 1)]++;
|
||||
id++;
|
||||
}
|
||||
|
||||
indices[xChange - 1]--;
|
||||
|
||||
if (id < neighborhoodSize) {
|
||||
for (int i = xChange - 2; i >= 0; i--)
|
||||
if (!change)
|
||||
change = nextIndices(i, _size);
|
||||
}
|
||||
|
||||
change = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the next combination of mapping indices
|
||||
* @param _indice compute next combination of indexes from this index
|
||||
* @param _size the solution size
|
||||
*/
|
||||
|
||||
bool nextIndices(int _indice, unsigned _size) {
|
||||
|
||||
if (indices[_indice + 1] == _size - xChange + 1 + _indice) {
|
||||
|
||||
if (indices[_indice] + 1 < _size - xChange + 1 + _indice) {
|
||||
|
||||
indices[_indice]++;
|
||||
unsigned int i = 1;
|
||||
|
||||
while (_indice + i < xChange) {
|
||||
|
||||
indices[_indice + i] = indices[_indice + i - 1] + 1;
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
indices[_indice + 1]++;
|
||||
unsigned int i = 2;
|
||||
|
||||
while (_indice + i < xChange) {
|
||||
|
||||
indices[_indice + i] = indices[_indice + i - 1] + 1;
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter to fix the number of x-change positions
|
||||
* @param _xChange the number of x-change
|
||||
*/
|
||||
|
||||
void setXChange(unsigned int _xChange) {
|
||||
xChange = _xChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of x-change
|
||||
*/
|
||||
|
||||
unsigned int getXChange() {
|
||||
return xChange;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUXChange";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
/*
|
||||
<moGPUXChangeNeighbor.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".
|
||||
|
||||
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 _moGPUXChangeNeighbor_h
|
||||
#define _moGPUXChangeNeighbor_h
|
||||
|
||||
#include <neighborhood/moIndexNeighbor.h>
|
||||
|
||||
/**
|
||||
* A X-Change Neighbor
|
||||
* useful in parallel computing, it allows to associate to a neighbor represented by a single index,a set of indices
|
||||
* to build the neighbor from the solution and the number of positions to change
|
||||
*/
|
||||
|
||||
template<class EOT, class Fitness = typename EOT::Fitness>
|
||||
class moGPUXChangeNeighbor: virtual public moIndexNeighbor<EOT> {
|
||||
|
||||
public:
|
||||
|
||||
using moIndexNeighbor<EOT>::key;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
|
||||
moGPUXChangeNeighbor() :
|
||||
moIndexNeighbor<EOT> (),xChange(0) {
|
||||
indices = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
*/
|
||||
|
||||
~moGPUXChangeNeighbor() {
|
||||
delete[] (indices);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xChange the number of x-change to do
|
||||
*/
|
||||
|
||||
moGPUXChangeNeighbor(unsigned int _xChange) {
|
||||
xChange = _xChange;
|
||||
indices = new unsigned int[xChange];
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy Constructor
|
||||
* @param _n the neighbor to copy
|
||||
*/
|
||||
|
||||
moGPUXChangeNeighbor(const moGPUXChangeNeighbor& _n) :
|
||||
moIndexNeighbor<EOT> (_n) {
|
||||
this->xChange = _n.xChange;
|
||||
this->indices = new unsigned int[xChange];
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
this->indices[i] = _n.indices[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
* @param _source the neighbor to assign to this curent neighbor
|
||||
*/
|
||||
|
||||
virtual moGPUXChangeNeighbor<EOT> & operator=(
|
||||
const moGPUXChangeNeighbor<EOT> & _source) {
|
||||
moIndexNeighbor<EOT, Fitness>::operator=(_source);
|
||||
this->xChange = _source.xChange;
|
||||
this->reSizeIndices(xChange);
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
this->indices[i] = _source.indices[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter to update the i'th index of x-change
|
||||
* @param _i the index to update
|
||||
* @param _val the new value to set to the i'th index of x-change
|
||||
*/
|
||||
|
||||
void setIndice(unsigned int _i, unsigned int _val) {
|
||||
indices[_i] = _val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the i'th index of x-change
|
||||
*/
|
||||
|
||||
unsigned int getIndice(unsigned int _i) {
|
||||
return indices[_i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter to update the set of x-change indexes
|
||||
* @param _indices the set of new value indexes of the x-change
|
||||
*/
|
||||
|
||||
void setIndices(unsigned int * _indices) {
|
||||
for (unsigned int i = 0; i < xChange; i++) {
|
||||
setIndice(i, _indices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter to fix the xChange
|
||||
* @param _xChange the number of swap
|
||||
*/
|
||||
|
||||
void setXChange(unsigned int _xChange) {
|
||||
xChange = _xChange;
|
||||
reSizeIndices(_xChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of swap
|
||||
*/
|
||||
|
||||
unsigned int getXChange() {
|
||||
return xChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the indices array of x-change indexes
|
||||
*@param _xChange the number of x-change
|
||||
*/
|
||||
|
||||
void reSizeIndices(unsigned int _xChange) {
|
||||
delete[] (indices);
|
||||
indices = new unsigned int[_xChange];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class name.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
|
||||
virtual std::string className() const {
|
||||
return "moGPUXChangeNeighbor";
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 >> xChange;
|
||||
_is >> key;
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
_is >> indices[i];
|
||||
fitness(repFit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the Neighbor
|
||||
*/
|
||||
|
||||
void print() {
|
||||
std::cout << "[";
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
std::cout<< indices[i]<< " ";
|
||||
std::cout << "] -> " << (*this).fitness() << std::endl;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
unsigned int * indices;
|
||||
unsigned int xChange;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
<moGPUXChangeNeighborhood.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 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 __moGPUXChangeNeighborhood_h
|
||||
#define __moGPUXChangeNeighborhood_h
|
||||
|
||||
#include <neighborhood/moGPUXChange.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
template<class N>
|
||||
class moGPUXChangeNeighborhood: public moGPUXChange<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define a Neighbor and type of a solution corresponding
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moGPUXChange<Neighbor>::neighborhoodSize;
|
||||
using moGPUXChange<Neighbor>::currentIndex;
|
||||
using moGPUXChange<Neighbor>::indices;
|
||||
using moGPUXChange<Neighbor>::mapping;
|
||||
using moGPUXChange<Neighbor>::xChange;
|
||||
using moGPUXChange<Neighbor>::mutex;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of x-change positions
|
||||
*/
|
||||
|
||||
moGPUXChangeNeighborhood(unsigned int _neighborhoodSize,
|
||||
unsigned int _xChange) :
|
||||
moGPUXChange<Neighbor> (_neighborhoodSize, _xChange) {
|
||||
sendMapping = false;
|
||||
cudaMalloc((void**) &device_Mapping, sizeof(unsigned int)
|
||||
* neighborhoodSize * _xChange);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*Destructor
|
||||
*/
|
||||
|
||||
~moGPUXChangeNeighborhood() {
|
||||
|
||||
cudaFree(device_Mapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood and mapping on device
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
|
||||
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moGPUXChange<Neighbor>::init(_solution, _current);
|
||||
if (!sendMapping) {
|
||||
cudaMemcpy(device_Mapping, mapping, xChange * neighborhoodSize
|
||||
* sizeof(unsigned int), cudaMemcpyHostToDevice);
|
||||
sendMapping = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUXChangeNeighborhood";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
bool sendMapping;
|
||||
unsigned int * device_Mapping;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
<moGPUXChangeNeighborhoodByCpy.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 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 __moGPUXChangeNeighborhoodByCpy_h
|
||||
#define __moGPUXChangeNeighborhoodByCpy_h
|
||||
|
||||
#include <neighborhood/moGPUXChangeNeighborhood.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
template<class N>
|
||||
class moGPUXChangeNeighborhoodByCpy: public moGPUXChangeNeighborhood<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define a Neighbor and type of a solution corresponding
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/*A tester*/
|
||||
using moGPUXChangeNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::currentIndex;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::indices;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::mapping;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::xChange;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::mutex;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::device_Mapping;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of x-change positions
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
|
||||
moGPUXChangeNeighborhoodByCpy(unsigned int _neighborhoodSize,
|
||||
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||
moGPUXChangeNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
|
||||
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moGPUXChangeNeighborhood<Neighbor>::init(_solution, _current);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution, device_Mapping,1,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUXChangeNeighborhoodByCpy";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
moGPUEval<Neighbor>& eval;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<moGPUXChangeNeighborhoodByModif.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 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 __moGPUXChangeNeighborhoodByModif_h
|
||||
#define __moGPUXChangeNeighborhoodByModif_h
|
||||
|
||||
#include <neighborhood/moGPUXChangeNeighborhood.h>
|
||||
#include <eval/moGPUEval.h>
|
||||
|
||||
template<class N>
|
||||
class moGPUXChangeNeighborhoodByModif: public moGPUXChangeNeighborhood<N> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define a Neighbor and type of a solution corresponding
|
||||
*/
|
||||
|
||||
typedef N Neighbor;
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moGPUXChangeNeighborhood<Neighbor>::neighborhoodSize;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::currentIndex;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::indices;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::mapping;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::xChange;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::mutex;
|
||||
using moGPUXChangeNeighborhood<Neighbor>::device_Mapping;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the neighborhood size
|
||||
* @param _xChange the number of x-change positions
|
||||
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||
*/
|
||||
|
||||
moGPUXChangeNeighborhoodByModif(unsigned int _neighborhoodSize,
|
||||
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||
moGPUXChangeNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
|
||||
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||
|
||||
moGPUXChangeNeighborhood<Neighbor>::init(_solution, _current);
|
||||
//Compute all neighbors fitness at one time
|
||||
eval.neighborhoodEval(_solution, device_Mapping,0,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUXChangeNeighborhoodByModif";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
moGPUEval<Neighbor>& eval;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
<moGPUXSwapN.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 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 _moGPUXSwapN_h
|
||||
#define _moGPUXSwapN_h
|
||||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moGPUXChangeNeighbor.h>
|
||||
|
||||
/**
|
||||
* A X-Swap Neighbor
|
||||
*/
|
||||
|
||||
template<class EOT, class Fitness = typename EOT::Fitness>
|
||||
class moGPUXSwapN: public moBackableNeighbor<EOT> ,
|
||||
public moGPUXChangeNeighbor<EOT> {
|
||||
|
||||
public:
|
||||
|
||||
using moGPUXChangeNeighbor<EOT>::indices;
|
||||
using moGPUXChangeNeighbor<EOT>::xChange;
|
||||
using moGPUXChangeNeighbor<EOT>::key;
|
||||
|
||||
/**
|
||||
*Default Constructor
|
||||
*/
|
||||
|
||||
moGPUXSwapN() :
|
||||
moGPUXChangeNeighbor<EOT> () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xSwap the number of swap to do
|
||||
*/
|
||||
|
||||
moGPUXSwapN(unsigned int _xSwap) :
|
||||
moGPUXChangeNeighbor<EOT> (_xSwap) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the K-swap
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
virtual void move(EOT& _solution) {
|
||||
EOT tmp(1);
|
||||
for (unsigned int i = 0; i < xChange-1; i++) {
|
||||
tmp[0] = _solution[indices[i]];
|
||||
_solution[indices[i]] = _solution[indices[i + 1]];
|
||||
_solution[indices[i + 1]] = tmp[0];
|
||||
}
|
||||
_solution.invalidate();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* apply the K-swap to restore the solution (use by moFullEvalByModif)
|
||||
* @param _solution the solution to move back
|
||||
*/
|
||||
virtual void moveBack(EOT& _solution) {
|
||||
EOT tmp(1);
|
||||
for (int i = xChange-1; i > 0; i--) {
|
||||
tmp[0] = _solution[indices[i]];
|
||||
_solution[indices[i]] = _solution[indices[i - 1]];
|
||||
_solution[indices[i - 1]] = tmp[0];
|
||||
}
|
||||
_solution.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class name.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUXSwapN";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
<moGPUXSwapNeighbor.h.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 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 __moGPUXSwapNeighbor_h
|
||||
#define __moGPUXSwapNeighbor_h
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moGPUXChangeNeighbor.h>
|
||||
#include <GPUType/moGPUPermutationVector.h>
|
||||
|
||||
/**
|
||||
* A GPU X-Swap Neighbor
|
||||
*/
|
||||
|
||||
template<class Fitness>
|
||||
class moGPUXSwapNeighbor: public moBackableNeighbor<moGPUPermutationVector<Fitness> > ,
|
||||
public moGPUXChangeNeighbor<moGPUPermutationVector<Fitness> > {
|
||||
|
||||
public:
|
||||
|
||||
typedef moGPUPermutationVector<Fitness> EOT ;
|
||||
using moGPUXChangeNeighbor<EOT>::indices;
|
||||
using moGPUXChangeNeighbor<EOT>::xChange;
|
||||
using moGPUXChangeNeighbor<EOT>::key;
|
||||
|
||||
/**
|
||||
*Default Constructor
|
||||
*/
|
||||
|
||||
moGPUXSwapNeighbor() :
|
||||
moGPUXChangeNeighbor<EOT> () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xSwap the number of swap to do
|
||||
*/
|
||||
|
||||
moGPUXSwapNeighbor(unsigned int _xSwap) :
|
||||
moGPUXChangeNeighbor<EOT> (_xSwap) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the K-swap
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
virtual void move(EOT& _solution) {
|
||||
EOT tmp(1);
|
||||
for (unsigned int i = 0; i < xChange-1; i++) {
|
||||
tmp[0] = _solution[indices[i]];
|
||||
_solution[indices[i]] = _solution[indices[i + 1]];
|
||||
_solution[indices[i + 1]] = tmp[0];
|
||||
}
|
||||
_solution.invalidate();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* apply the K-swap to restore the solution (use by moFullEvalByModif)
|
||||
* @param _solution the solution to move back
|
||||
*/
|
||||
virtual void moveBack(EOT& _solution) {
|
||||
EOT tmp(1);
|
||||
for (int i = xChange-1; i > 0; i--) {
|
||||
tmp[0] = _solution[indices[i]];
|
||||
_solution[indices[i]] = _solution[indices[i - 1]];
|
||||
_solution[indices[i - 1]] = tmp[0];
|
||||
}
|
||||
_solution.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class name.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUXSwapNeighbor";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
<moGPUTimer.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 __moGPUTimer_H_
|
||||
#define __moGPUTimer_H_
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
/**
|
||||
* To compute execution time
|
||||
*/
|
||||
|
||||
class moGPUTimer {
|
||||
|
||||
public:
|
||||
|
||||
timeval tim;
|
||||
double t1;
|
||||
double t2;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUTimer() {
|
||||
|
||||
t1 = 0;
|
||||
t2 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUTimer() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* to start compute execution time
|
||||
*/
|
||||
|
||||
void start() {
|
||||
|
||||
// Start timer
|
||||
gettimeofday(&tim, NULL);
|
||||
t1 = tim.tv_sec + (tim.tv_usec / 1000000.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* to stop compute execution time
|
||||
*/
|
||||
|
||||
void stop() {
|
||||
|
||||
// Stop timer
|
||||
gettimeofday(&tim, NULL);
|
||||
t2 = tim.tv_sec + (tim.tv_usec / 1000000.0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* to get timer value in s
|
||||
* @return execution time in s
|
||||
*/
|
||||
|
||||
double getTime() {
|
||||
|
||||
// get time
|
||||
return (t2 - t1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
<moGPUPPPData.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 _moGPUPPPData_H_
|
||||
#define _moGPUPPPData_H_
|
||||
|
||||
#include <memory/moGPUSpecificData.h>
|
||||
|
||||
template<class ElemType>
|
||||
class moGPUPPPData: public moGPUSpecificData {
|
||||
|
||||
public:
|
||||
|
||||
using moGPUSpecificData::GPUObject;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
|
||||
moGPUPPPData() :
|
||||
moGPUSpecificData() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor by copy
|
||||
* @param _pppData the specific data of PPP
|
||||
*/
|
||||
|
||||
moGPUPPPData(const moGPUPPPData & _pppData) {
|
||||
|
||||
a_h = new int[Md * Nd];
|
||||
H_h = new int[Nd];
|
||||
|
||||
for (int i = 0; i < Md; i++)
|
||||
for (int j = 0; j < Nd; j++) {
|
||||
a_h[i * Nd + j] = _pppData.a_h[i * Nd + j];
|
||||
}
|
||||
for (int k = 0; k < Nd; k++) {
|
||||
H_h[k] = _pppData.H_h[k];
|
||||
}
|
||||
|
||||
GPUObject.memCopy(a_d, a_h, Nd * Md);
|
||||
GPUObject.memCopy(H_d, H_h, Nd);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignement operator
|
||||
* @param _pppData the specific data of PPP
|
||||
* @return a PPP Data
|
||||
*/
|
||||
|
||||
moGPUPPPData & operator=(const moGPUPPPData & _pppData) {
|
||||
|
||||
a_h = new int[Md * Nd];
|
||||
H_h = new int[Nd];
|
||||
for (int i = 0; i < Md; i++)
|
||||
for (int j = 0; j < Nd; j++) {
|
||||
a_h[i * Nd + j] = _pppData.a_h[i * Nd + j];
|
||||
}
|
||||
for (int k = 0; k < Nd; k++) {
|
||||
H_h[k] = _pppData.H_h[k];
|
||||
}
|
||||
|
||||
GPUObject.memCopy(a_d, a_h, Nd * Md);
|
||||
GPUObject.memCopy(H_d, H_h, Nd);
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUPPPData() {
|
||||
GPUObject.memFree(a_d);
|
||||
GPUObject.memFree(H_d);
|
||||
delete[] a_h;
|
||||
delete[] H_h;
|
||||
}
|
||||
|
||||
/*
|
||||
*Load PPP data
|
||||
*/
|
||||
|
||||
void load(char * _fileName) {
|
||||
}
|
||||
|
||||
void load() {
|
||||
|
||||
int *v = new int[Nd];
|
||||
int *s = new int[Md];
|
||||
a_h = new int[Md * Nd];
|
||||
H_h = new int[Nd];
|
||||
for (int i = 0; i < Nd; i++)
|
||||
H_h[i] = 0;
|
||||
for (int i = 0; i < Md; i++) {
|
||||
for (int j = 0; j < Nd; j++) {
|
||||
a_h[i * Nd + j] =pow(-1,rand());
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < Nd; i++) {
|
||||
v[i]=pow(-1,rand());
|
||||
}
|
||||
|
||||
for (int i = 0; i < Md; i++) {
|
||||
s[i] = 0;
|
||||
for (int j = 0; j < Nd; j++)
|
||||
s[i] += a_h[i * Nd + j] * v[j];
|
||||
if (s[i] < 0) {
|
||||
for (int k = 0; k < Nd; k++)
|
||||
a_h[i * Nd + k] = -a_h[i * Nd + k];
|
||||
s[i] = -s[i];
|
||||
}
|
||||
if(s[i]>0)
|
||||
H_h[s[i]-1]++;
|
||||
}
|
||||
|
||||
//Allocate and copy PPP data from CPU memory to GPU global memory
|
||||
GPUObject.memCopy(a_d, a_h, Nd * Md);
|
||||
GPUObject.memCopy(H_d, H_h, Nd);
|
||||
|
||||
delete[] v;
|
||||
delete[] s;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
ElemType* a_h;
|
||||
ElemType* H_h;
|
||||
ElemType* a_d;
|
||||
ElemType* H_d;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
/*
|
||||
<moGPUQAPData.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 _moGPUQAPData_H_
|
||||
#define _moGPUQAPData_H_
|
||||
|
||||
#include <memory/moGPUSpecificData.h>
|
||||
|
||||
template<class ElemType>
|
||||
class moGPUQAPData: public moGPUSpecificData {
|
||||
|
||||
public:
|
||||
|
||||
using moGPUSpecificData::sizeData;
|
||||
using moGPUSpecificData::GPUObject;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
|
||||
moGPUQAPData() :
|
||||
moGPUSpecificData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _fileName the data file name
|
||||
*/
|
||||
|
||||
moGPUQAPData(char* _fileName) {
|
||||
|
||||
(*this).load(_fileName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor by copy
|
||||
* @param _qapData the specific data of QAP
|
||||
*/
|
||||
|
||||
moGPUQAPData(const moGPUQAPData & _qapData) {
|
||||
|
||||
sizeData = _qapData.sizeData;
|
||||
a_h = new int[sizeData * sizeData];
|
||||
b_h = new int[sizeData * sizeData];
|
||||
for (int i = 0; i < sizeData; i++)
|
||||
|
||||
for (int j = 0; j < sizeData; j++) {
|
||||
|
||||
a_h[i * sizeData + j] = _qapData.a_h[i * sizeData + j];
|
||||
b_h[i * sizeData + j] = _qapData.b_h[i * sizeData + j];
|
||||
|
||||
}
|
||||
|
||||
GPUObject.memCopy(a_d, a_h, sizeData * sizeData);
|
||||
GPUObject.memCopy(b_d, b_h, sizeData * sizeData);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignement operator
|
||||
* @param _qapData the specific data of QAP
|
||||
* @return a QAP Data
|
||||
*/
|
||||
|
||||
moGPUQAPData & operator=(const moGPUQAPData & _qapData) {
|
||||
|
||||
sizeData = _qapData.sizeData;
|
||||
a_h = new int[sizeData * sizeData];
|
||||
b_h = new int[sizeData * sizeData];
|
||||
|
||||
for (int i = 0; i < sizeData; i++)
|
||||
for (int j = 0; j < sizeData; j++) {
|
||||
|
||||
a_h[i * sizeData + j] = _qapData.a_h[i * sizeData + j];
|
||||
b_h[i * sizeData + j] = _qapData.b_h[i * sizeData + j];
|
||||
|
||||
}
|
||||
GPUObject.memCopy(a_d, a_h, sizeData * sizeData);
|
||||
GPUObject.memCopy(b_d, b_h, sizeData * sizeData);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUQAPData() {
|
||||
GPUObject.memFree(a_d);
|
||||
GPUObject.memFree(b_d);
|
||||
delete[] a_h;
|
||||
delete[] b_h;
|
||||
}
|
||||
|
||||
/*
|
||||
*Load QAP data from file name
|
||||
*@param _fileName the data file name to load
|
||||
*/
|
||||
|
||||
void load(char* _fileName) {
|
||||
|
||||
fstream file(_fileName, ios::in);
|
||||
if (!file) {
|
||||
|
||||
string str = "QAPData: Could not open file [" + (string) _fileName
|
||||
+ "].";
|
||||
throw runtime_error(str);
|
||||
}
|
||||
|
||||
unsigned i, j;
|
||||
file >> sizeData;
|
||||
a_h = new ElemType[sizeData * sizeData];
|
||||
b_h = new ElemType[sizeData * sizeData];
|
||||
|
||||
for (i = 0; i < sizeData; i++)
|
||||
for (j = 0; j < sizeData; j++)
|
||||
file >> a_h[i * sizeData + j];
|
||||
for (i = 0; i < sizeData; i++)
|
||||
for (j = 0; j < sizeData; j++)
|
||||
file >> b_h[i * sizeData + j];
|
||||
|
||||
//Allocate and copy QAP data from CPU memory to GPU global memory
|
||||
GPUObject.memCopy(a_d, a_h, sizeData * sizeData);
|
||||
GPUObject.memCopy(b_d, b_h, sizeData * sizeData);
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
ElemType* a_h;
|
||||
ElemType* b_h;
|
||||
ElemType* a_d;
|
||||
ElemType* b_d;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
<moGPUEvalOneMax.h>
|
||||
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 __moGPUEvalOneMax_H
|
||||
#define __moGPUEvalOneMax_H
|
||||
|
||||
/**
|
||||
* Full Evaluation of the solution
|
||||
*/
|
||||
|
||||
template<class EOT>
|
||||
class moGPUEvalOneMax: public eoEvalFunc<EOT> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUEvalOneMax() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUEvalOneMax(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
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
<moGPUOneMaxIncrEval.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 __moGPUOneMaxIncrEval_H
|
||||
#define __moGPUOneMaxIncrEval_H
|
||||
|
||||
#include <eval/moGPUEvalFunc.h>
|
||||
|
||||
/**
|
||||
* Incremental Evaluation of OneMax
|
||||
*/
|
||||
|
||||
template<class Neighbor>
|
||||
class moGPUOneMaxIncrEval: public moGPUEvalFunc<Neighbor> {
|
||||
|
||||
public:
|
||||
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
typedef typename EOT::ElemType T;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUOneMaxIncrEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUOneMaxIncrEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Incremental evaluation of the OneMax solution(bit vector),function inline can be called from host or device
|
||||
* @param _bitVector the solution to evaluate
|
||||
* @param _fitness the fitness of the current solution
|
||||
* @param _index an array that contains a set of indexes corresponding to the current thread identifier neighbor the last element of this array contains neighborhood size
|
||||
*/
|
||||
|
||||
inline __host__ __device__ Fitness operator() (T * _bitVector,Fitness _fitness, unsigned int * _index) {
|
||||
|
||||
Fitness tmp=_fitness;
|
||||
for(unsigned i=0;i<NB_POS;i++) {
|
||||
|
||||
if (_bitVector[_index[i]] == 0)
|
||||
tmp= tmp+1;
|
||||
else
|
||||
tmp= tmp-1;
|
||||
|
||||
}
|
||||
return tmp;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
<moGPUPPPEval.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 __moGPUPPPEval_H
|
||||
#define __moGPUPPPEval_H
|
||||
|
||||
#include <problems/data/moGPUPPPData.h>
|
||||
|
||||
template<class EOT, class ElemType = typename EOT::ElemType>
|
||||
class moGPUPPPEval: public eoEvalFunc<EOT> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _pppData the specific data problem useful to evalute solution( vector of 1 & _1 for PPP)
|
||||
*/
|
||||
|
||||
moGPUPPPEval(moGPUPPPData<ElemType> & _pppData) {
|
||||
pppData = _pppData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUPPPEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Full evaluation of the solution
|
||||
* @param _sol the solution to evaluate
|
||||
*/
|
||||
|
||||
void operator()(EOT & _sol) {
|
||||
|
||||
int *H;
|
||||
int tmp;
|
||||
int tmp_1 = 0;
|
||||
int tmp_2 = 0;
|
||||
|
||||
H = new int[Nd];
|
||||
|
||||
for (int i = 0; i < Md; i++) {
|
||||
tmp = 0;
|
||||
for (int j = 0; j < Nd; j++) {
|
||||
tmp += pppData.a_h[i * Nd + j] * _sol[j];
|
||||
}
|
||||
|
||||
tmp_1 += abs(tmp) - tmp;
|
||||
if (tmp > 0)
|
||||
H[tmp-1]++;
|
||||
}
|
||||
|
||||
for (int j = 0; j < Nd; j++) {
|
||||
tmp_2 += abs(pppData.H_h[j] - H[j]);
|
||||
}
|
||||
|
||||
_sol.fitness(ca * tmp_1 + cb * tmp_2);
|
||||
|
||||
delete[] H;
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
moGPUPPPData<ElemType> pppData;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
<moGPUPPPIncrEval.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 __moGPUPPPIncrEval_H
|
||||
#define __moGPUPPPIncrEval_H
|
||||
|
||||
#include <eval/moGPUEvalFunc.h>
|
||||
|
||||
/**
|
||||
* Incremental Evaluation of PPP
|
||||
*/
|
||||
|
||||
template<class Neighbor>
|
||||
class moGPUPPPIncrEval: public moGPUEvalFunc<Neighbor> {
|
||||
|
||||
public:
|
||||
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
typedef typename EOT::ElemType T;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUPPPIncrEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUPPPIncrEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Incremental evaluation of the PPP solution,function inline can be called from host or device
|
||||
* @param _sol the solution to evaluate
|
||||
* @param _fitness the fitness of the current solution
|
||||
* @param _index an array that contains a set of indexes corresponding to the current thread identifier neighbor the last element of this array contains neighborhood size
|
||||
*/
|
||||
|
||||
inline __host__ __device__ Fitness operator() (T* _sol,Fitness _fitness, unsigned int *_index) {
|
||||
|
||||
int H[Nd];
|
||||
int S[Md];
|
||||
int tmp_1=0;
|
||||
int tmp_2=0;
|
||||
|
||||
for (unsigned i=0; i<Md; i++) {
|
||||
S[i]=0;
|
||||
for (int j=0; j<Nd; j++)
|
||||
S[i]+=dev_a[i*Nd+j]*_sol[j];
|
||||
}
|
||||
|
||||
|
||||
for (unsigned j=0; j<Nd; j++)
|
||||
H[j]=0;
|
||||
for (unsigned i=0; i<Md; i++) {
|
||||
for(unsigned k=0;k<NB_POS;k++)
|
||||
S[i]=S[i]-2*dev_a[i*Nd+_index[k]]*_sol[_index[k]];
|
||||
tmp_1=tmp_1+abs(S[i])-S[i];
|
||||
if(S[i]>0)
|
||||
H[S[i]-1]=H[S[i]-1]+1;
|
||||
}
|
||||
|
||||
for (unsigned j=0; j<Nd; j++)
|
||||
tmp_2=tmp_2+abs(dev_h[j]-H[j]);
|
||||
|
||||
return ca*tmp_1+cb*tmp_2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
<moGPUQAPEval.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 __moGPUQAPEval_H
|
||||
#define __moGPUQAPEval_H
|
||||
|
||||
#include <problems/data/moGPUQAPData.h>
|
||||
|
||||
template<class EOT, class ElemType = typename EOT::ElemType>
|
||||
class moGPUQAPEval: public eoEvalFunc<EOT> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _qapData the specific data problem useful to evalute solution(flow & distance matrices of QAP problem)
|
||||
*/
|
||||
|
||||
moGPUQAPEval(moGPUQAPData<ElemType> & _qapData) {
|
||||
qapData = _qapData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUQAPEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Full evaluation of the solution
|
||||
* @param _sol the solution to evaluate
|
||||
*/
|
||||
|
||||
void operator()(EOT & _sol) {
|
||||
int cost = 0;
|
||||
unsigned int size = qapData.getSize();
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
for (unsigned int j = 0; j < size; j++) {
|
||||
cost += qapData.a_h[i * size + j] * qapData.b_h[_sol[i] * size
|
||||
+ _sol[j]];
|
||||
}
|
||||
|
||||
_sol.fitness(cost);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
moGPUQAPData<ElemType> qapData;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
<moGPUQAPIncrEval.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 __moGPUQAPIncrEval_H
|
||||
#define __moGPUQAPIncrEval_H
|
||||
|
||||
#include <eval/moGPUEvalFunc.h>
|
||||
|
||||
/**
|
||||
* Parallel Incremental Evaluation of QAP
|
||||
*/
|
||||
|
||||
template<class Neighbor>
|
||||
class moGPUQAPIncrEval: public moGPUEvalFunc<Neighbor> {
|
||||
|
||||
public:
|
||||
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
typedef typename EOT::ElemType T;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
moGPUQAPIncrEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
|
||||
~moGPUQAPIncrEval() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Incremental evaluation of the QAP solution,function inline can be called from host or device
|
||||
* @param _sol the solution to evaluate
|
||||
* @param _fitness the fitness of the current solution
|
||||
* @param _index an array that contains a set of indexes corresponding to the current thread identifier neighbor the last element of this array contains neighborhood size
|
||||
*/
|
||||
|
||||
inline __host__ __device__ Fitness operator() (T * _sol,Fitness _fitness, unsigned int *_index) {
|
||||
|
||||
Fitness tmp=_fitness;
|
||||
|
||||
T tmp_sol[1];
|
||||
/*
|
||||
* dev_a & dev_b are global device variable, data specific to QAP problem (flow & distance matices)
|
||||
* _index[i] the first position of swap
|
||||
* _index[i+1] the second position of swap
|
||||
*/
|
||||
for(unsigned i=0;i<NB_POS-1;i++) {
|
||||
tmp=tmp+compute_delta(dev_a,dev_b,_sol,_index[i],_index[i+1]);
|
||||
tmp_sol[0]=_sol[_index[i]];
|
||||
_sol[_index[i]]=_sol[_index[i+1]];
|
||||
_sol[_index[i+1]]=tmp_sol[0];
|
||||
}
|
||||
return tmp;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* compute the new fitness of the solution after permutation of pair(i,j)(function inline called from host device)
|
||||
* @param a the flow matrix of size*size (specific data of QAP problem must be declared as global device variable)
|
||||
* @param b the distance matrix of size*size (specific data of QAP problem must be declared as global device variable)
|
||||
* @param _sol the solution to evaluate
|
||||
* @param i the first position of swap
|
||||
* @param j the second position of swap
|
||||
*/
|
||||
|
||||
inline __host__ __device__ int compute_delta(int * a,int * b,T * _sol, int i, int j) {
|
||||
|
||||
|
||||
int d;
|
||||
int k;
|
||||
int n=SIZE;
|
||||
|
||||
d = (a[i*n+i]-a[j*n+j])*(b[_sol[j]*n+_sol[j]]-b[_sol[i]*n+_sol[i]]) +
|
||||
(a[i*n+j]-a[j*n+i])*(b[_sol[j]*n+_sol[i]]-b[_sol[i]*n+_sol[j]]);
|
||||
for (k = 0; k < n; k = k + 1)
|
||||
if (k!=i && k!=j)
|
||||
d = d + (a[k*n+i]-a[k*n+j])*(b[_sol[k]*n+_sol[j]]-b[_sol[k]*n+_sol[i]]) +
|
||||
(a[i*n+k]-a[j*n+k])*(b[_sol[j]*n+_sol[k]]-b[_sol[i]*n+_sol[k]]);
|
||||
return(d);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
<moGPUCustomizedNeighbor.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 _moGPUCustomizedNeighbor_h
|
||||
#define _moGPUCustomizedNeighbor_h
|
||||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moGPUXChangeNeighbor.h>
|
||||
#include <problems/types/moGPUSolType2Vector.h>
|
||||
|
||||
/**
|
||||
* Neighbor related to a solution vector composed by two vectors
|
||||
*/
|
||||
|
||||
template<class Fitness>
|
||||
class moGPUCustomizedNeighbor: public moBackableNeighbor< moGPUSolType2Vector<Fitness> > ,
|
||||
public moGPUXChangeNeighbor< moGPUSolType2Vector<Fitness> > {
|
||||
|
||||
public:
|
||||
|
||||
using moGPUXChangeNeighbor< moGPUSolType2Vector<Fitness> >::indices;
|
||||
using moGPUXChangeNeighbor< moGPUSolType2Vector<Fitness> >::xChange;
|
||||
using moGPUXChangeNeighbor< moGPUSolType2Vector<Fitness> >::key;
|
||||
/**
|
||||
*Default Constructor
|
||||
*/
|
||||
|
||||
moGPUCustomizedNeighbor() :
|
||||
moGPUXChangeNeighbor< moGPUSolType2Vector<Fitness> > () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xSwap the number of bit to swap
|
||||
*/
|
||||
|
||||
moGPUCustomizedNeighbor(unsigned int _xSwap) :
|
||||
moGPUXChangeNeighbor< moGPUSolType2Vector<Fitness> > (_xSwap) {
|
||||
}
|
||||
|
||||
/**
|
||||
* move the solution
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
|
||||
virtual void move(moGPUSolType2Vector<Fitness> & _solution) {
|
||||
std::cout<<"_solution"<<std::endl;
|
||||
float tmp;
|
||||
tmp = _solution[0].tab2[indices[0]];
|
||||
_solution[0].tab2[indices[0]] = _solution[0].tab2[indices[1]];
|
||||
_solution[0].tab2[indices[1]] = tmp;
|
||||
std::cout<<_solution<<std::endl;
|
||||
_solution.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* apply the moveBack to restore the solution (use by moFullEvalByModif)
|
||||
* @param _solution the solution to move back
|
||||
*/
|
||||
|
||||
virtual void moveBack(moGPUSolType2Vector<Fitness> & _solution) {
|
||||
move(_solution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class name.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moGPUCustomizedNeighbor";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
<moGPUPPPNeighbor.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 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 __moGPUPPPNeighbor_h
|
||||
#define __moGPUPPPNeighbor_h
|
||||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moGPUXChangeNeighbor.h>
|
||||
|
||||
/**
|
||||
* A GPU PPP Neighbor
|
||||
*/
|
||||
|
||||
template<class EOT, class Fitness=typename EOT::Fitness>
|
||||
class moGPUPPPNeighbor: public moBackableNeighbor<EOT> , public moGPUXChangeNeighbor<
|
||||
EOT> {
|
||||
public:
|
||||
|
||||
using moGPUXChangeNeighbor<EOT>::indices;
|
||||
using moGPUXChangeNeighbor<EOT>::xChange;
|
||||
using moGPUXChangeNeighbor<EOT>::key;
|
||||
|
||||
/**
|
||||
*Default Constructor
|
||||
*/
|
||||
|
||||
moGPUPPPNeighbor() :
|
||||
moGPUXChangeNeighbor<EOT> () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xFlip the number of bit to flip
|
||||
*/
|
||||
|
||||
moGPUPPPNeighbor(unsigned int _xFlip) :
|
||||
moGPUXChangeNeighbor<EOT> (_xFlip) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the K-Flip in solution
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
|
||||
virtual void move(EOT& _solution) {
|
||||
for (unsigned int i = 0; i < xChange; i++)
|
||||
_solution[indices[i]] = -_solution[indices[i]];
|
||||
|
||||
_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 "moGPUPPPNeighbor";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
<moGPUCustomizeType.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 _moGPUCustomizeType_H_
|
||||
#define _moGPUCustomizeType_H_
|
||||
|
||||
/**
|
||||
* Implementation of an Example of customized type
|
||||
*/
|
||||
|
||||
template<class T1, class T2>
|
||||
struct sol2Type {
|
||||
|
||||
T1 tab1[SIZE];
|
||||
T2 tab2[SIZE];
|
||||
|
||||
inline __host__ __device__ sol2Type& operator=(const sol2Type _vector) {
|
||||
for (unsigned i = 0; i < SIZE; i++) {
|
||||
|
||||
tab1[i] = _vector.tab1[i];
|
||||
tab2[i] = _vector.tab2[i];
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline __host__ __device__ unsigned size() {
|
||||
|
||||
return SIZE;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class T1, class T2,class T3>
|
||||
struct sol3Type {
|
||||
|
||||
T1 tab1[SIZE];
|
||||
T2 tab2[SIZE];
|
||||
T3 tab3[SIZE];
|
||||
|
||||
inline __host__ __device__ sol3Type& operator=(const sol3Type _vector) {
|
||||
|
||||
for (unsigned i = 0; i < SIZE; i++) {
|
||||
|
||||
tab1[i] = _vector.tab1[i];
|
||||
tab2[i] = _vector.tab2[i];
|
||||
tab3[i] = _vector.tab3[i];
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline __host__ __device__ unsigned size() {
|
||||
|
||||
return SIZE;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
template<class T1, class T2,class T3,class T4>
|
||||
struct sol4Type {
|
||||
|
||||
T1 tab1[SIZE];
|
||||
T2 tab2[SIZE];
|
||||
T3 tab3[SIZE];
|
||||
T4 tab4[SIZE];
|
||||
|
||||
inline __host__ __device__ sol4Type& operator=(const sol4Type _vector) {
|
||||
|
||||
for (unsigned i = 0; i < SIZE; i++) {
|
||||
tab1[i] = _vector.tab1[i];
|
||||
tab2[i] = _vector.tab2[i];
|
||||
tab3[i] = _vector.tab3[i];
|
||||
tab4[i] = _vector.tab4[i];
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline __host__ __device__ unsigned size() {
|
||||
|
||||
return SIZE;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
<moGPUPPPSolution.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 __moGPUPPPSolution_H_
|
||||
#define __moGPUPPPSolution_H_
|
||||
|
||||
#include <GPUType/moGPUVector.h>
|
||||
|
||||
/**
|
||||
* Implementation of PPP vector representation on GPU.
|
||||
*/
|
||||
|
||||
template<class Fitness>
|
||||
|
||||
class moGPUPPPSolution: public moGPUVector<int, Fitness> {
|
||||
|
||||
public:
|
||||
|
||||
using moGPUVector<int, Fitness>::vect;
|
||||
using moGPUVector<int, Fitness>::N;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
|
||||
moGPUPPPSolution() :
|
||||
moGPUVector<int, Fitness> () {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*Constructor.
|
||||
*@param _size The neighborhood size.
|
||||
*/
|
||||
|
||||
moGPUPPPSolution(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.
|
||||
*/
|
||||
|
||||
moGPUPPPSolution& operator=(const moGPUPPPSolution & _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 PPP vector.
|
||||
*/
|
||||
void create() {
|
||||
|
||||
for (int i = 0; i < N; i++) {
|
||||
if ((rng.rand() % 2) == 0)
|
||||
vect[i] = -1;
|
||||
else
|
||||
vect[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*Function inline to set the size of vector, called from host and device.
|
||||
*@param _size the vector size
|
||||
*/
|
||||
|
||||
virtual void setSize(unsigned _size){
|
||||
N=_size;
|
||||
}
|
||||
/**
|
||||
* Print the solution
|
||||
*/
|
||||
|
||||
virtual 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
|
||||
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
<moGPUSolType2Vector.h>
|
||||
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 _moGPUSolType2Vector_H_
|
||||
#define _moGPUSolType2Vector_H_
|
||||
|
||||
#include <GPUType/moGPUVector.h>
|
||||
#include <problems/types/moGPUCustomizeType.h>
|
||||
|
||||
/**
|
||||
* An Example of a customized vector representation on GPU.
|
||||
*/
|
||||
|
||||
typedef struct sol2Type<int, float> ElemType;
|
||||
template<class Fitness>
|
||||
class moGPUSolType2Vector: public moGPUVector<ElemType, Fitness> {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Define vector type of vector corresponding to Solution
|
||||
*/
|
||||
|
||||
using moGPUVector<ElemType, Fitness>::vect;
|
||||
using moGPUVector<ElemType, Fitness>::N;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
|
||||
moGPUSolType2Vector() :
|
||||
moGPUVector<ElemType, Fitness> () {
|
||||
}
|
||||
|
||||
/**
|
||||
*Constructor.
|
||||
*@param _size The size of the vector to create.
|
||||
*/
|
||||
|
||||
moGPUSolType2Vector(unsigned _size) :
|
||||
moGPUVector<ElemType, Fitness> (_size) {
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
*Assignment operator
|
||||
*@param _vector The vector passed to the function determine the new content.
|
||||
*@return a new vector.
|
||||
*/
|
||||
|
||||
moGPUSolType2Vector<Fitness> & operator=(
|
||||
const moGPUSolType2Vector<Fitness> & _vector) {
|
||||
|
||||
vect[0] = _vector[0];
|
||||
if (!(_vector.invalid()))
|
||||
fitness(_vector.fitness());
|
||||
else
|
||||
(*this).invalidate();
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
*How to fill the vector.
|
||||
*/
|
||||
|
||||
virtual void create() {
|
||||
|
||||
for (int i = 0; i < vect[0].size(); i++) {
|
||||
vect[0].tab1[i] = (int) (rng.rand() % (vect[0].size() - i) + i);
|
||||
vect[0].tab2[i] = (float) (rng.rand() % (vect[0].size() - i) + (i*2));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*Function inline to set the size of vector, called from host and device.
|
||||
*@param _size the vector size
|
||||
*/
|
||||
|
||||
virtual void setSize(unsigned _size) {
|
||||
N = _size;
|
||||
}
|
||||
/**
|
||||
* Print the solution
|
||||
*/
|
||||
|
||||
virtual void printOn(std::ostream& os) const {
|
||||
|
||||
EO<Fitness>::printOn(os);
|
||||
os << ' ';
|
||||
os << vect[0].size() << ' ';
|
||||
unsigned int i;
|
||||
for (i = 0; i < vect[0].size(); i++) {
|
||||
os << vect[0].tab1[i] << ' ';
|
||||
}
|
||||
os << endl;
|
||||
for (i = 0; i < vect[0].size(); i++) {
|
||||
os << vect[0].tab2[i] << ' ';
|
||||
}
|
||||
os << endl;
|
||||
|
||||
}
|
||||
|
||||
inline __host__ __device__ unsigned size() {
|
||||
|
||||
return N;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
<t-moGPUTimer.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <performance/moGPUTimer.h>
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUTimer] => START" << std::endl;
|
||||
Timer t;
|
||||
t.start();
|
||||
sleep(5);
|
||||
t.stop();
|
||||
double t0=t.getTime();
|
||||
double t1=5;
|
||||
assert(t0==t1);
|
||||
std::cout << "[t-moGPUTimer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
|
||||
# include CUDA source directory
|
||||
${CUDA_DIR}/include
|
||||
# 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 ${CUDA_DIR}/lib )
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your targets and link the librairies
|
||||
######################################################################################
|
||||
|
||||
SET (TEST_LIST
|
||||
t-moGPUBitNeighbor
|
||||
t-moGPUBitVector
|
||||
t-moGPUEvalOneMax
|
||||
t-moGPUIntVector
|
||||
t-moGPUMemory
|
||||
t-moGPUNeighborhoodSizeUtils
|
||||
t-moGPUObject
|
||||
t-moGPUOneMaxIncrEval
|
||||
t-moGPUPermutationVector
|
||||
t-moGPURealVector
|
||||
t-moGPUTimer
|
||||
t-moGPUXBitFlippingNeighbor
|
||||
t-moGPUXChangeNeighbor
|
||||
t-moGPUXChangeNeighborhood
|
||||
t-moGPUXSwapNeighbor
|
||||
t-moXBitFlippingNeighbor
|
||||
t-moXSwapNeighbor
|
||||
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
######################################################################################
|
||||
### 4) Link the librairies for your target(s)
|
||||
######################################################################################
|
||||
# Link the librairies
|
||||
FOREACH (test ${TEST_LIST})
|
||||
TARGET_LINK_LIBRARIES(${test} ga es eoutils eo)
|
||||
ENDFOREACH (test)
|
||||
|
||||
ENDIF(ENABLE_CMAKE_TESTING)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
<moTestClass.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 _moGPUTestClass_h
|
||||
#define _moGPUTestClass_h
|
||||
|
||||
#include <moTestClass.h>
|
||||
#include <neighborhood/moGPUXChangeNeighbor.h>
|
||||
|
||||
template<class EOT>
|
||||
class XChangeNeighborDummy: public moGPUXChangeNeighbor<EOT> {
|
||||
public:
|
||||
|
||||
XChangeNeighborDummy() :
|
||||
moGPUXChangeNeighbor<EOT> () {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _xChange the number of x-change to do
|
||||
*/
|
||||
|
||||
XChangeNeighborDummy(unsigned int _xChange) :
|
||||
moGPUXChangeNeighbor<EOT> (_xChange) {
|
||||
}
|
||||
/**
|
||||
* Move a solution
|
||||
* @param _solution the related solution
|
||||
*/
|
||||
void move(EOT & _solution) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<t-moGPUBitNeighbor.cu>
|
||||
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
|
||||
*/
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <neighborhood/moGPUBitNeighbor.h>
|
||||
|
||||
typedef moGPUBitVector<eoMaximizingFitness> Solution;
|
||||
typedef moGPUBitNeighbor<eoMaximizingFitness> Neighbor;
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUBitNeighbor] => START" << std::endl;
|
||||
|
||||
//init sol
|
||||
Solution sol(3);
|
||||
sol[0]=1;
|
||||
sol[1]=0;
|
||||
sol[2]=1;
|
||||
|
||||
//test default Constructor
|
||||
Neighbor test1;
|
||||
assert(test1.index()==0);
|
||||
|
||||
//test index setter
|
||||
test1.index(6);
|
||||
//test index getter
|
||||
assert(test1.index()==6);
|
||||
|
||||
//test fitness setter
|
||||
test1.fitness(2);
|
||||
//test fitness getter
|
||||
assert(test1.fitness()==2);
|
||||
|
||||
//test Cpy constructor
|
||||
Neighbor test2(test1);
|
||||
assert(test2.index()==6);
|
||||
assert(test2.fitness()==2);
|
||||
|
||||
//test assignement operator
|
||||
test1.fitness(8);
|
||||
test1.index(2);
|
||||
test2=test1;
|
||||
assert(test2.fitness()==8);
|
||||
assert(test2.index()==2);
|
||||
|
||||
//test move
|
||||
test2.move(sol);
|
||||
assert(!sol[2]);
|
||||
|
||||
//test moveBack
|
||||
test2.moveBack(sol);
|
||||
assert(sol[2]);
|
||||
|
||||
test1.printOn(std::cout);
|
||||
test2.printOn(std::cout);
|
||||
|
||||
assert(test1.className()=="moGPUBitNeighbor");
|
||||
|
||||
std::cout << "[t-moGPUBitNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
<t-moGPUBitVector.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <GPUType/moGPUBitVector.h>
|
||||
#include <problems/eval/moGPUEvalOneMax.h>
|
||||
#include <eo>
|
||||
|
||||
typedef moGPUBitVector<eoMaximizingFitness> Solution;
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUBitVector] => START" << std::endl;
|
||||
|
||||
moGPUEvalOneMax<Solution> eval;
|
||||
|
||||
//test default constructor
|
||||
Solution _sol;
|
||||
|
||||
//test constructor
|
||||
Solution sol1(5);
|
||||
|
||||
//test copy constructor
|
||||
sol1.fitness(10);
|
||||
Solution sol(sol1);
|
||||
assert(sol.size()==5);
|
||||
assert(sol.fitness()==10);
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol1[i]);
|
||||
|
||||
//test random vector of bool
|
||||
for(int i=0;i<5;i++)
|
||||
assert((sol[i]==0)||(sol[i]==1));
|
||||
|
||||
//test oneMax eval function
|
||||
eval(sol);
|
||||
eoMaximizingFitness sum=0;
|
||||
for(int i=0;i<5;i++)
|
||||
sum=sum+sol[i];
|
||||
assert(sol.fitness()==sum);
|
||||
|
||||
//test size getter
|
||||
assert(_sol.size()==5);
|
||||
assert(sol1.size()==5);
|
||||
|
||||
//test size setter
|
||||
sol1.setSize(10);
|
||||
assert(sol1.size()==10);
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol1[i]);
|
||||
for(int i=5;i<10;i++)
|
||||
assert((sol1[i]==0)||(sol1[i]==1));
|
||||
|
||||
|
||||
//test 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);
|
||||
|
||||
//test accessor to the vector of bool
|
||||
sol2[3]=0;
|
||||
assert(sol2[3]==0);
|
||||
eval(sol2);
|
||||
assert(sol2.fitness()==3);
|
||||
|
||||
//test assignement operator
|
||||
sol2=sol;
|
||||
assert(sol.size()==sol2.size());
|
||||
assert(sol.fitness()==sol2.fitness());
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol2[i]);
|
||||
|
||||
std::cout << "[t-moGPUBitVector] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
<t-moGPUEvalOneMax.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <GPUType/moGPUBitVector.h>
|
||||
#include <problems/eval/moGPUEvalOneMax.h>
|
||||
|
||||
typedef moGPUBitVector<eoMaximizingFitness> Solution;
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUEvalOneMax] => START" << std::endl;
|
||||
|
||||
|
||||
Solution sol(5);
|
||||
moGPUEvalOneMax<Solution> 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-moGPUEvalOneMax] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
<t-moGPUIntVector.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <GPUType/moGPUIntVector.h>
|
||||
#include <eo>
|
||||
|
||||
typedef moGPUIntVector<eoMaximizingFitness> Solution;
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUIntVector] => START" << std::endl;
|
||||
|
||||
//test Default constructor
|
||||
Solution _sol;
|
||||
assert(_sol.size()==0);
|
||||
|
||||
//test constructor
|
||||
Solution sol1(5);
|
||||
Solution sol2(3);
|
||||
|
||||
//test copy constructor
|
||||
sol1.fitness(50);
|
||||
Solution sol(sol1);
|
||||
assert(sol.size()==5);
|
||||
assert(sol.fitness()==50);
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol1[i]);
|
||||
|
||||
//test Integer vector (create)& getter
|
||||
int tmp;
|
||||
for(int i=0;i<5;i++){
|
||||
tmp=sol1[i]%2;
|
||||
assert((tmp==0)||(tmp==1));
|
||||
}
|
||||
//test size getter
|
||||
assert(sol1.size()==5);
|
||||
assert(sol2.size()==3);
|
||||
|
||||
//test size setter
|
||||
sol1.setSize(10);
|
||||
assert(sol1.size()==10);
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol1[i]);
|
||||
for(int i=5;i<10;i++){
|
||||
tmp=sol1[i]%2;
|
||||
assert((tmp==0)||(tmp==1));
|
||||
}
|
||||
|
||||
//test assignement operator
|
||||
sol2.fitness(20);
|
||||
sol1=sol2;
|
||||
assert(sol1.size()==3);
|
||||
assert(sol1.fitness()==20);
|
||||
for(int i=0;i<3;i++)
|
||||
assert(sol1[i]==sol2[i]);
|
||||
|
||||
|
||||
std::cout << "[t-moGPUIntVector] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
<t-moGPUMemory.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <memory/moGPUAllocator.h>
|
||||
#include <memory/moGPUDeallocator.h>
|
||||
#include <memory/moGPUCopy.h>
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUMemory] => START" << std::endl;
|
||||
|
||||
int * h_data;
|
||||
int * cpy_data;
|
||||
int * d_data;
|
||||
moGPUAllocator alloc;
|
||||
moGPUDeallocator dealloc;
|
||||
moGPUCopy cpy;
|
||||
int i=0;
|
||||
|
||||
//data allocation
|
||||
h_data= new int[5];
|
||||
cpy_data= new int[5];
|
||||
|
||||
//test GPU data allocation
|
||||
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);
|
||||
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);
|
||||
for(i=0;i<5;i++)
|
||||
assert(cpy_data[i]==i*2);
|
||||
|
||||
//test GPU memory deallocation
|
||||
dealloc(d_data);
|
||||
|
||||
delete[] h_data;
|
||||
delete[] cpy_data;
|
||||
std::cout << "[t-moGPUMemory] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
<t-moGPUNeighborhoodSizeUtils.cpp>
|
||||
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 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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <neighborhood/moGPUNeighborhoodSizeUtils.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moGPUNeighborhoodSizeUtils] => START" << std::endl;
|
||||
|
||||
//test factorial
|
||||
int fact;
|
||||
fact = factorial(5);
|
||||
assert(fact == (5 * 4 * 3 * 2 * 1));
|
||||
|
||||
//test Size of Mapping
|
||||
int sizeMap = sizeMapping(5, 1);
|
||||
assert(sizeMap == 5);
|
||||
|
||||
sizeMap = sizeMapping(5, 2);
|
||||
assert(sizeMap == 10);
|
||||
|
||||
sizeMap = sizeMapping(6, 3);
|
||||
assert(sizeMap == 20);
|
||||
|
||||
std::cout << "[t-moGPUNeighborhoodSizeUtils] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
<t-moGPUObject.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <memory/moGPUObject.h>
|
||||
|
||||
//GPU global variable
|
||||
__device__ int * dev_data;
|
||||
|
||||
//kernel to launch to test GPU global variable
|
||||
|
||||
__global__ void testKernel(int * _data,unsigned _size){
|
||||
|
||||
// The thread identifier within a grid block's
|
||||
int id = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
|
||||
if(id<_size)
|
||||
|
||||
_data[id]=2*dev_data[id];
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUObject] => START" << std::endl;
|
||||
|
||||
int * h_data;
|
||||
int * cpy_data;
|
||||
int * d_data;
|
||||
moGPUObject obj;
|
||||
int i=0;
|
||||
|
||||
//data allocation
|
||||
h_data= new int[5];
|
||||
cpy_data= new int[5];
|
||||
|
||||
for(i=0;i<5;i++)
|
||||
h_data[i]=i;
|
||||
|
||||
//test allocation & copy from host to device
|
||||
obj.memCopy(d_data,h_data,5);
|
||||
|
||||
//test copy from device to host
|
||||
obj.copy(cpy_data,d_data,5,0);
|
||||
for(i=0;i<5;i++)
|
||||
assert(cpy_data[i]==i);
|
||||
|
||||
//test copy of GPU global variable and using it in kernel
|
||||
obj.memCopyGlobalVariable(dev_data,d_data);
|
||||
testKernel<<<1,8>>>(d_data,5);
|
||||
obj.copy(cpy_data,d_data,5,0);
|
||||
for(i=0;i<5;i++)
|
||||
assert(cpy_data[i]==i*2);
|
||||
|
||||
//Free GPU object
|
||||
obj.memFree(d_data);
|
||||
|
||||
delete[] h_data;
|
||||
delete[] cpy_data;
|
||||
std::cout << "[t-moGPUObject] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
<t-OneMaxIncrEval.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <neighborhood/moGPUBitNeighbor.h>
|
||||
#include <GPUType/moGPUBitVector.h>
|
||||
#include <problems/eval/moGPUEvalOneMax.h>
|
||||
#include <problems/eval/moGPUOneMaxIncrEval.h>
|
||||
|
||||
#define NB_POS 1
|
||||
|
||||
typedef moGPUBitVector<eoMaximizingFitness> Solution;
|
||||
typedef moGPUBitNeighbor <Solution,eoMaximizingFitness> Neighbor;
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUOneMaxIncrEval] => START" << std::endl;
|
||||
|
||||
|
||||
Solution sol(5);
|
||||
moGPUEvalOneMax<Solution> eval;
|
||||
moGPUOneMaxIncrEval<Neighbor> 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);
|
||||
|
||||
sol[0]=1;
|
||||
fitness=incr_eval(sol,fitness,0);
|
||||
assert((int)(fitness)==1);
|
||||
assert((int)(sol.fitness())==1);
|
||||
|
||||
sol[2]=1;
|
||||
fitness=incr_eval(sol,fitness,2);
|
||||
assert((int)(fitness)==2);
|
||||
assert((int)(sol.fitness())==2);
|
||||
|
||||
std::cout << "[t-moGPUOneMaxIncrEval] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
<t-moGPUPermutationVector.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <GPUType/moGPUPermutationVector.h>
|
||||
#include <eo>
|
||||
|
||||
typedef moGPUPermutationVector<eoMaximizingFitness> Solution;
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPUPermutationVector] => START" << std::endl;
|
||||
|
||||
//test Default constructor
|
||||
Solution _sol;
|
||||
|
||||
//test constructor
|
||||
Solution sol1(5);
|
||||
Solution sol2(3);
|
||||
|
||||
//test copy constructor
|
||||
sol1.fitness(20);
|
||||
Solution sol(sol1);
|
||||
assert(sol.size()==5);
|
||||
assert(sol.fitness()==20);
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol1[i]);
|
||||
|
||||
//test discret vector create & getter
|
||||
for(int i=0;i<5;i++)
|
||||
assert((sol1[i]>=0)||(sol1[i]<5));
|
||||
|
||||
//test size getter
|
||||
assert(sol1.size()==5);
|
||||
assert(sol2.size()==3);
|
||||
|
||||
//test size setter
|
||||
sol1.setSize(4);
|
||||
assert(sol1.size()==4);
|
||||
|
||||
|
||||
//test discret vector
|
||||
for(int i=0;i<3;i++)
|
||||
assert((sol2[i]>=0)||(sol2[i]<3));
|
||||
sol2.fitness(30);
|
||||
|
||||
//test assignement operator
|
||||
sol1=sol2;
|
||||
assert(sol1.size()==3);
|
||||
assert(sol1.fitness()==30);
|
||||
for(int i=0;i<3;i++)
|
||||
assert(sol1[i]==sol2[i]);
|
||||
|
||||
|
||||
std::cout << "[t-moGPUPermutationVector] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<t-moGPURealVector.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <GPUType/moGPURealVector.h>
|
||||
#include <eo>
|
||||
|
||||
typedef moGPURealVector<eoMaximizingFitness> Solution;
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
std::cout << "[t-moGPURealVector] => START" << std::endl;
|
||||
|
||||
//test Default constructor
|
||||
Solution _sol;
|
||||
assert(_sol.size()==0);
|
||||
|
||||
//test constructor
|
||||
Solution sol1(5);
|
||||
Solution sol2(3);
|
||||
|
||||
//test copy constructor
|
||||
sol1.fitness(10);
|
||||
Solution sol(sol1);
|
||||
assert(sol.size()==5);
|
||||
assert(sol.fitness()==10);
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol1[i]);
|
||||
|
||||
//test Real vector (create)& getter
|
||||
int tmp,tmp1;
|
||||
tmp=(1/(sol1[0]+1))*10;
|
||||
tmp1=(int)(1/(sol1[0]+));
|
||||
|
||||
assert(tmp1>tmp);
|
||||
}
|
||||
|
||||
//test size getter
|
||||
assert(sol1.size()==5);
|
||||
assert(sol2.size()==3);
|
||||
|
||||
//test size setter
|
||||
sol1.setSize(10);
|
||||
assert(sol1.size()==10);
|
||||
for(int i=0;i<5;i++)
|
||||
assert(sol[i]==sol1[i]);
|
||||
|
||||
//test assignement operator
|
||||
sol2.fitness(20);
|
||||
sol1=sol2;
|
||||
assert(sol1.size()==3);
|
||||
assert(sol1.fitness()==20);
|
||||
for(int i=0;i<3;i++)
|
||||
assert(sol1[i]==sol2[i]);
|
||||
|
||||
|
||||
std::cout << "[t-moGPURealVector] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
<t-moGPUXBitFlippingNeighbor.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <eo>
|
||||
#include <neighborhood/moGPUXBitFlippingNeighbor.h>
|
||||
|
||||
typedef moGPUBitVector<eoMaximizingFitness> Solution;
|
||||
typedef moGPUXBitFlippingNeighbor<eoMaximizingFitness> Neighbor;
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moGPUXBitFlippingNeighbor] => START" << std::endl;
|
||||
|
||||
Solution sol(5, 0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
sol[i] = (i % 2 == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
assert(sol[0] == 0);
|
||||
assert(sol[1] == 1);
|
||||
assert(sol[2] == 0);
|
||||
assert(sol[3] == 1);
|
||||
assert(sol[4] == 0);
|
||||
|
||||
//test constructor
|
||||
Neighbor neighbor;
|
||||
assert(neighbor.index() == 0);
|
||||
//test x-change getter
|
||||
assert(neighbor.getXChange() == 0);
|
||||
|
||||
//test x-change setter
|
||||
neighbor.setXChange(2);
|
||||
assert(neighbor.getXChange() == 2);
|
||||
|
||||
//test index setter
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
neighbor.setIndice(i, i);
|
||||
|
||||
//test index getter
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
assert(neighbor.getIndice(i) == i);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 1);
|
||||
assert(sol[neighbor.getIndice(1)] == 0);
|
||||
|
||||
//test moveBack
|
||||
neighbor.moveBack(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 0);
|
||||
assert(sol[neighbor.getIndice(1)] == 1);
|
||||
|
||||
//test set & get indice
|
||||
neighbor.setIndice(0, 1);
|
||||
neighbor.setIndice(1, 2);
|
||||
assert(neighbor.getIndice(0) == 1);
|
||||
assert(neighbor.getIndice(1) == 2);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 0);
|
||||
assert(sol[neighbor.getIndice(1)] == 1);
|
||||
|
||||
//test move back
|
||||
neighbor.moveBack(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 1);
|
||||
assert(sol[neighbor.getIndice(1)] == 0);
|
||||
|
||||
Neighbor neighbor1(3);
|
||||
|
||||
//test setter of one index
|
||||
neighbor1.setIndice(0, 2);
|
||||
neighbor1.setIndice(1, 3);
|
||||
neighbor1.setIndice(2, 4);
|
||||
|
||||
//test getter of one index
|
||||
assert(neighbor1.getIndice(0) == 2);
|
||||
assert(neighbor1.getIndice(1) == 3);
|
||||
assert(neighbor1.getIndice(2) == 4);
|
||||
|
||||
//test move
|
||||
neighbor1.move(sol);
|
||||
assert(sol[neighbor1.getIndice(0)] == 1);
|
||||
assert(sol[neighbor1.getIndice(1)] == 0);
|
||||
assert(sol[neighbor1.getIndice(2)] == 1);
|
||||
|
||||
//test moveBack
|
||||
neighbor1.moveBack(sol);
|
||||
assert(sol[neighbor1.getIndice(0)] == 0);
|
||||
assert(sol[neighbor1.getIndice(1)] == 1);
|
||||
assert(sol[neighbor1.getIndice(2)] == 0);
|
||||
|
||||
std::cout << "[t-moGPUXBitFlippingNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
<t-moGPUXChangeNeighbor.cu>
|
||||
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 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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <eo>
|
||||
#include <eoInt.h>
|
||||
#include <moTestClass.h>
|
||||
|
||||
typedef eoInt<eoMaximizingFitness> Sol;
|
||||
typedef XChangeNeighborDummy<Sol> Neighbor;
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moGPUXChangeNeighbor] => START" << std::endl;
|
||||
|
||||
//test default constructor
|
||||
Neighbor neighbor0;
|
||||
assert(neighbor0.index() == 0);
|
||||
assert(neighbor0.getXChange() == 0);
|
||||
|
||||
//test constructor
|
||||
Neighbor neighbor(5);
|
||||
assert(neighbor.index() == 0);
|
||||
assert(neighbor.getXChange() == 5);
|
||||
|
||||
//test setter & getter of one index
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
neighbor.setIndice(i, i);
|
||||
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
assert(neighbor.getIndice(i) == i);
|
||||
|
||||
//test copy Constructor
|
||||
Neighbor neighbor1(neighbor);
|
||||
assert(neighbor1.index() == 0);
|
||||
assert(neighbor1.getXChange() == 5);
|
||||
for (unsigned int i = 0; i < neighbor1.getXChange(); i++)
|
||||
assert(neighbor1.getIndice(i) == i);
|
||||
|
||||
//test assignement operator
|
||||
|
||||
for (unsigned int i = 0; i < neighbor1.getXChange(); i++)
|
||||
neighbor1.setIndice(i, 0);
|
||||
|
||||
Neighbor neighbor2(2);
|
||||
|
||||
//test setter of one index
|
||||
neighbor2.setIndice(0, 0);
|
||||
neighbor2.setIndice(1, 1);
|
||||
neighbor2.setIndice(2, 2);
|
||||
|
||||
//test getter of one index
|
||||
assert(neighbor2.getIndice(0) == 0);
|
||||
assert(neighbor2.getIndice(1) == 1);
|
||||
assert(neighbor2.getIndice(2) == 2);
|
||||
|
||||
std::cout << "[t-moGPUXChangeNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
/*
|
||||
<t-moGPUXChange.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <eoInt.h>
|
||||
#include <neighborhood/moGPUXSwapN.h>
|
||||
#include <neighborhood/moGPUXChange.h>
|
||||
#include <neighborhood/moGPUNeighborhoodSizeUtils.h>
|
||||
#include <eo>
|
||||
|
||||
typedef eoInt<eoMaximizingFitness> Solution;
|
||||
typedef moGPUXSwapN<Solution> Neighbor;
|
||||
typedef moGPUXChange<Neighbor> Neighborhood;
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moGPUXChange] => START" << std::endl;
|
||||
|
||||
//test factorial
|
||||
assert(factorial(10) == 3628800);
|
||||
|
||||
//test sizeMapping
|
||||
assert(sizeMapping(6, 1) == 6);
|
||||
assert(sizeMapping(6, 2) == 15);
|
||||
assert(sizeMapping(6, 3) == 20);
|
||||
assert(sizeMapping(6, 4) == 15);
|
||||
assert(sizeMapping(6, 5) == 6);
|
||||
|
||||
Solution sol(6);
|
||||
Neighbor neighbor(2);
|
||||
Neighbor neighbor1;
|
||||
|
||||
unsigned int * first;
|
||||
unsigned int * second;
|
||||
unsigned int * third;
|
||||
unsigned int * forth;
|
||||
|
||||
first = new unsigned int[15];
|
||||
second = new unsigned int[15];
|
||||
third = new unsigned int[15];
|
||||
forth = new unsigned int[15];
|
||||
|
||||
unsigned int id = 0;
|
||||
for (unsigned int i = 0; i < 5; i++)
|
||||
for (unsigned int j = i + 1; j < 6; j++) {
|
||||
first[id] = i;
|
||||
second[id] = j;
|
||||
id++;
|
||||
}
|
||||
|
||||
//test Constructor
|
||||
Neighborhood neighborhood(15, 2);
|
||||
//test x-change getter
|
||||
assert(neighborhood.getXChange() == 2);
|
||||
//test neighborhoodSize getter
|
||||
assert(neighborhood.getNeighborhoodSize() == 15);
|
||||
//test current index getter
|
||||
assert(neighborhood.position() == 0);
|
||||
|
||||
//test neighborhood methods
|
||||
|
||||
//test hasNeighbor
|
||||
assert(neighborhood.hasNeighbor(sol) == true);
|
||||
|
||||
//test init
|
||||
neighborhood.init(sol, neighbor);
|
||||
assert(neighbor.index() == 0);
|
||||
assert(neighbor.getXChange() == 2);
|
||||
assert(neighborhood.position() == 0);
|
||||
|
||||
//test Mapping
|
||||
assert(neighbor.getIndice(0) == first[neighborhood.position()]);
|
||||
assert(neighbor.getIndice(1) == second[neighborhood.position()]);
|
||||
|
||||
//test next & cont
|
||||
unsigned i = 1;
|
||||
while (neighborhood.cont(sol)) {
|
||||
neighborhood.next(sol, neighbor);
|
||||
assert(neighborhood.position() == i);
|
||||
//test Mapping
|
||||
assert(neighbor.getIndice(0) == first[neighborhood.position()]);
|
||||
assert(neighbor.getIndice(1) == second[neighborhood.position()]);
|
||||
i++;
|
||||
}
|
||||
|
||||
id = 0;
|
||||
for (unsigned int i = 0; i < 3; i++)
|
||||
for (unsigned int j = i + 1; j < 4; j++)
|
||||
for (unsigned int k = j + 1; k < 5; k++)
|
||||
for (unsigned int l = k + 1; l < 6; l++) {
|
||||
first[id] = i;
|
||||
second[id] = j;
|
||||
third[id] = k;
|
||||
forth[id] = l;
|
||||
id++;
|
||||
}
|
||||
|
||||
//test Constructor
|
||||
Neighborhood neighborhood1(15, 4);
|
||||
//test x-change getter
|
||||
assert(neighborhood1.getXChange() == 4);
|
||||
//test neighborhood1Size getter
|
||||
assert(neighborhood1.getNeighborhoodSize() == 15);
|
||||
//test current index getter
|
||||
assert(neighborhood1.position() == 0);
|
||||
|
||||
//test neighborhood methods
|
||||
|
||||
//test hasNeighbor
|
||||
assert(neighborhood1.hasNeighbor(sol) == true);
|
||||
|
||||
//test init
|
||||
neighborhood1.init(sol, neighbor1);
|
||||
assert(neighbor1.index() == 0);
|
||||
assert(neighbor1.getXChange() == 4);
|
||||
assert(neighborhood1.position() == 0);
|
||||
|
||||
//test Mapping
|
||||
assert(neighbor1.getIndice(0) == first[neighborhood1.position()]);
|
||||
assert(neighbor1.getIndice(1) == second[neighborhood1.position()]);
|
||||
assert(neighbor1.getIndice(2) == third[neighborhood1.position()]);
|
||||
assert(neighbor1.getIndice(3) == forth[neighborhood1.position()]);
|
||||
|
||||
//test next & cont
|
||||
i = 1;
|
||||
while (neighborhood.cont(sol)) {
|
||||
neighborhood.next(sol, neighbor1);
|
||||
assert(neighborhood.position() == i);
|
||||
//test Mapping
|
||||
assert(neighbor1.getIndice(0) == first[neighborhood1.position()]);
|
||||
assert(neighbor1.getIndice(1) == second[neighborhood1.position()]);
|
||||
assert(neighbor1.getIndice(2) == third[neighborhood1.position()]);
|
||||
assert(neighbor1.getIndice(3) == forth[neighborhood1.position()]);
|
||||
i++;
|
||||
}
|
||||
|
||||
delete[] (first);
|
||||
delete[] (second);
|
||||
delete[] (third);
|
||||
delete[] (forth);
|
||||
std::cout << "[t-moGPUXChange] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
<t-moGPUXSwapN.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <eoInt.h>
|
||||
#include <neighborhood/moGPUXSwapN.h>
|
||||
#include <eo>
|
||||
|
||||
typedef eoInt<eoMaximizingFitness> Solution;
|
||||
typedef moGPUXSwapN<Solution> Neighbor;
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moGPUXSwapN] => START" << std::endl;
|
||||
|
||||
Solution sol1(5);
|
||||
for (int i = 4; i >=0; i--)
|
||||
sol1[4-i] = i;
|
||||
|
||||
//test constructor
|
||||
Neighbor neighbor(2);
|
||||
assert(neighbor.index() == 0);
|
||||
assert(neighbor.getXChange() == 2);
|
||||
|
||||
//test setter of one index
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
neighbor.setIndice(i, i);
|
||||
|
||||
//test getter of one index
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
assert(neighbor.getIndice(i) == i);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 3);
|
||||
assert(sol1[neighbor.getIndice(1)] == 4);
|
||||
|
||||
//test moveBack
|
||||
neighbor.moveBack(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 4);
|
||||
assert(sol1[neighbor.getIndice(1)] == 3);
|
||||
|
||||
//test set & get indice
|
||||
neighbor.setIndice(0, 1);
|
||||
neighbor.setIndice(1, 2);
|
||||
assert(neighbor.getIndice(0) == 1);
|
||||
assert(neighbor.getIndice(1) == 2);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 2);
|
||||
assert(sol1[neighbor.getIndice(1)] == 3);
|
||||
|
||||
//test move back
|
||||
neighbor.moveBack(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 3);
|
||||
assert(sol1[neighbor.getIndice(1)] == 2);
|
||||
|
||||
Neighbor neighbor2(3);
|
||||
|
||||
//test setter of one index
|
||||
neighbor2.setIndice(0, 0);
|
||||
neighbor2.setIndice(1, 1);
|
||||
neighbor2.setIndice(2, 2);
|
||||
|
||||
//test getter of one index
|
||||
assert(neighbor2.getIndice(0) == 0);
|
||||
assert(neighbor2.getIndice(1) == 1);
|
||||
assert(neighbor2.getIndice(2) == 2);
|
||||
|
||||
//test move
|
||||
neighbor2.move(sol1);
|
||||
assert(sol1[neighbor2.getIndice(0)] == 3);
|
||||
assert(sol1[neighbor2.getIndice(1)] == 2);
|
||||
assert(sol1[neighbor2.getIndice(2)] == 4);
|
||||
|
||||
//test moveBack
|
||||
neighbor2.moveBack(sol1);
|
||||
assert(sol1[neighbor2.getIndice(0)] == 4);
|
||||
assert(sol1[neighbor2.getIndice(1)] == 3);
|
||||
assert(sol1[neighbor2.getIndice(2)] == 2);
|
||||
|
||||
std::cout << "[t-moGPUXSwapN] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
/*
|
||||
<t-moGPUXSwapNeighbor.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <neighborhood/moGPUXSwapNeighbor.h>
|
||||
#include <GPUType/moGPUPermutationVector.h>
|
||||
#include <eo>
|
||||
|
||||
typedef moGPUPermutationVector<eoMaximizingFitness> Solution;
|
||||
typedef moGPUXSwapNeighbor<eoMaximizingFitness> Neighbor;
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moGPUXSwapNeighbor] => START" << std::endl;
|
||||
|
||||
Solution sol1(5);
|
||||
for (int i = 4; i >=0; i--)
|
||||
sol1[4-i] = i;
|
||||
|
||||
//test constructor
|
||||
Neighbor neighbor(2);
|
||||
assert(neighbor.index() == 0);
|
||||
assert(neighbor.getXChange() == 2);
|
||||
|
||||
//test setter of one index
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
neighbor.setIndice(i, i);
|
||||
|
||||
//test getter of one index
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
assert(neighbor.getIndice(i) == i);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 3);
|
||||
assert(sol1[neighbor.getIndice(1)] == 4);
|
||||
|
||||
//test moveBack
|
||||
neighbor.moveBack(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 4);
|
||||
assert(sol1[neighbor.getIndice(1)] == 3);
|
||||
|
||||
//test set & get indice
|
||||
neighbor.setIndice(0, 1);
|
||||
neighbor.setIndice(1, 2);
|
||||
assert(neighbor.getIndice(0) == 1);
|
||||
assert(neighbor.getIndice(1) == 2);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 2);
|
||||
assert(sol1[neighbor.getIndice(1)] == 3);
|
||||
|
||||
//test move back
|
||||
neighbor.moveBack(sol1);
|
||||
assert(sol1[neighbor.getIndice(0)] == 3);
|
||||
assert(sol1[neighbor.getIndice(1)] == 2);
|
||||
|
||||
Neighbor neighbor2(3);
|
||||
|
||||
//test setter of one index
|
||||
neighbor2.setIndice(0, 0);
|
||||
neighbor2.setIndice(1, 1);
|
||||
neighbor2.setIndice(2, 2);
|
||||
|
||||
//test getter of one index
|
||||
assert(neighbor2.getIndice(0) == 0);
|
||||
assert(neighbor2.getIndice(1) == 1);
|
||||
assert(neighbor2.getIndice(2) == 2);
|
||||
|
||||
//test move
|
||||
neighbor2.move(sol1);
|
||||
assert(sol1[neighbor2.getIndice(0)] == 3);
|
||||
assert(sol1[neighbor2.getIndice(1)] == 2);
|
||||
assert(sol1[neighbor2.getIndice(2)] == 4);
|
||||
|
||||
//test moveBack
|
||||
neighbor2.moveBack(sol1);
|
||||
assert(sol1[neighbor2.getIndice(0)] == 4);
|
||||
assert(sol1[neighbor2.getIndice(1)] == 3);
|
||||
assert(sol1[neighbor2.getIndice(2)] == 2);
|
||||
|
||||
std::cout << "[t-moGPUXSwapNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
<t-moGPUXBitFlippingN.cu>
|
||||
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
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <neighborhood/moGPUXBitFlippingN.h>
|
||||
#include <eo>
|
||||
#include <ga/eoBit.h>
|
||||
|
||||
typedef eoBit<eoMaximizingFitness> Solution;
|
||||
typedef moGPUXBitFlippingNeighbor<Solution> Neighbor;
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moGPUXBitFlippingNeighbor] => START" << std::endl;
|
||||
|
||||
Solution sol(5, 0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
sol[i] = (i % 2 == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
assert(sol[0] == 0);
|
||||
assert(sol[1] == 1);
|
||||
assert(sol[2] == 0);
|
||||
assert(sol[3] == 1);
|
||||
assert(sol[4] == 0);
|
||||
|
||||
//test constructor
|
||||
Neighbor neighbor;
|
||||
assert(neighbor.index() == 0);
|
||||
//test x-change getter
|
||||
assert(neighbor.getXChange() == 0);
|
||||
|
||||
//test x-change setter
|
||||
neighbor.setXChange(2);
|
||||
assert(neighbor.getXChange() == 2);
|
||||
|
||||
//test index setter
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
neighbor.setIndice(i, i);
|
||||
|
||||
//test index getter
|
||||
for (unsigned int i = 0; i < neighbor.getXChange(); i++)
|
||||
assert(neighbor.getIndice(i) == i);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 1);
|
||||
assert(sol[neighbor.getIndice(1)] == 0);
|
||||
|
||||
//test moveBack
|
||||
neighbor.moveBack(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 0);
|
||||
assert(sol[neighbor.getIndice(1)] == 1);
|
||||
|
||||
//test set & get indice
|
||||
neighbor.setIndice(0, 1);
|
||||
neighbor.setIndice(1, 2);
|
||||
assert(neighbor.getIndice(0) == 1);
|
||||
assert(neighbor.getIndice(1) == 2);
|
||||
|
||||
//test move
|
||||
neighbor.move(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 0);
|
||||
assert(sol[neighbor.getIndice(1)] == 1);
|
||||
|
||||
//test move back
|
||||
neighbor.moveBack(sol);
|
||||
assert(sol[neighbor.getIndice(0)] == 1);
|
||||
assert(sol[neighbor.getIndice(1)] == 0);
|
||||
|
||||
Neighbor neighbor1(3);
|
||||
|
||||
//test setter of one index
|
||||
neighbor1.setIndice(0, 2);
|
||||
neighbor1.setIndice(1, 3);
|
||||
neighbor1.setIndice(2, 4);
|
||||
|
||||
//test getter of one index
|
||||
assert(neighbor1.getIndice(0) == 2);
|
||||
assert(neighbor1.getIndice(1) == 3);
|
||||
assert(neighbor1.getIndice(2) == 4);
|
||||
|
||||
//test move
|
||||
neighbor1.move(sol);
|
||||
assert(sol[neighbor1.getIndice(0)] == 1);
|
||||
assert(sol[neighbor1.getIndice(1)] == 0);
|
||||
assert(sol[neighbor1.getIndice(2)] == 1);
|
||||
|
||||
//test moveBack
|
||||
neighbor1.moveBack(sol);
|
||||
assert(sol[neighbor1.getIndice(0)] == 0);
|
||||
assert(sol[neighbor1.getIndice(1)] == 1);
|
||||
assert(sol[neighbor1.getIndice(2)] == 0);
|
||||
|
||||
std::cout << "[t-moGPUXBitFlippingNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
ADD_SUBDIRECTORY(OneMax)
|
||||
ADD_SUBDIRECTORY(KswapNeighborhood)
|
||||
ADD_SUBDIRECTORY(Kswap-OneMax)
|
||||
ADD_SUBDIRECTORY(PPP_GPU)
|
||||
ADD_SUBDIRECTORY(QAP_GPU)
|
||||
ADD_SUBDIRECTORY(QAP_CPU)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue