Skip to content

Commit

Permalink
Merge branch 'shoc' of https://github.com/isuruf/pocl
Browse files Browse the repository at this point in the history
  • Loading branch information
pjaaskel committed Jul 16, 2020
2 parents f3e0cb8 + 48cb5cd commit a54ec90
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ add_subdirectory("examples")
# make check & make check_tier1

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} "--output-on-failure" -j ${CORECOUNT} ${COMMAND_USES_TERMINAL})
add_custom_target(check_tier1 COMMAND ${CMAKE_CTEST_COMMAND} "--output-on-failure" -L "'internal|amdsdk_30|piglit|PyOpenCL|conformance_suite_micro'" -j ${CORECOUNT} ${COMMAND_USES_TERMINAL})
add_custom_target(check_tier1 COMMAND ${CMAKE_CTEST_COMMAND} "--output-on-failure" -L "'internal|amdsdk_30|piglit|PyOpenCL|conformance_suite_micro|shoc'" -j ${CORECOUNT} ${COMMAND_USES_TERMINAL})

set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/CPack.pocl.description.txt")
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/doc/www/img/pocl-80x60.png")
Expand Down
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ set(ALL_TESTSUITES
conformance CloverLeaf Halide IntelSVM
opencl-book-samples OpenCV
Parboil piglit PyOpenCL
Rodinia VexCL ViennaCL Glow)
Rodinia shoc VexCL ViennaCL Glow)

if("${ENABLE_TESTSUITES}" STREQUAL "all")
set(ENABLE_TESTSUITES ${ALL_TESTSUITES})
endif()

if("${ENABLE_TESTSUITES}" MATCHES "tier1")
list(REMOVE_ITEM ENABLE_TESTSUITES "tier1")
list(APPEND ENABLE_TESTSUITES "AMDSDK3.0" "piglit" "conformance" "CLBlast")
list(APPEND ENABLE_TESTSUITES "AMDSDK3.0" "piglit" "conformance" "CLBlast", "shoc")
endif()

include(ExternalProject)
Expand Down
94 changes: 94 additions & 0 deletions examples/shoc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#=============================================================================
# CMake build system files
#
# Copyright (c) 2015 pocl developers
#
# 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.
#
#=============================================================================

set(TS_NAME "shoc")
set(TS_BASEDIR "${TESTSUITE_BASEDIR}/${TS_NAME}")
set(TS_BUILDDIR "${TS_BASEDIR}/src/${TS_NAME}-build")
set(TS_SRCDIR "${TS_BASEDIR}/src/${TS_NAME}")

# Release is 8 years old. Use git
set(EXAMPLES_USE_GIT_MASTER 1)

if(EXAMPLES_USE_GIT_MASTER)
set(FETCH_SOURCE
GIT_REPOSITORY "https://github.com/vetter/shoc.git"
)
else()
set(FETCH_SOURCE URL "https://github.com/vetter/shoc/archive/v1.1.4.tar.gz")
endif()

if(NOT TESTS_USE_ICD)
message(STATUS "Disabling testsuite ${TS_NAME}, requires ocl-icd")
elseif(NOT BASH)
message(STATUS "Disabling testsuite ${TS_NAME}, can't find bash shell")
endif()

message(STATUS "Enabling testsuite ${TS_NAME}")
list(APPEND ACTUALLY_ENABLED_TESTSUITES "${TS_NAME}")
set(ACTUALLY_ENABLED_TESTSUITES ${ACTUALLY_ENABLED_TESTSUITES} PARENT_SCOPE)

ExternalProject_Add(
${TS_NAME}
PREFIX "${TS_BASEDIR}"
${FETCH_SOURCE}

# have to use external scripts, because CMake has /bin/sh hardcoded,
# and /bin/sh on Ubuntu is dash, which doesn't support "source"
# command.
CONFIGURE_COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/configure.sh"
"${TS_BASEDIR}"
"${TS_BUILDDIR}"
"${TS_SRCDIR}"

BUILD_COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/build.sh"
"${TS_BASEDIR}"
"${TS_BUILDDIR}"
"${TS_SRCDIR}"

INSTALL_COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/install.sh"
"${TS_BASEDIR}"
"${TS_BUILDDIR}"
"${TS_SRCDIR}"
)

set_target_properties(${TS_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE)
add_dependencies(prepare_examples ${TS_NAME})

foreach (TEST_NAME Scan Sort)
add_test(NAME "shoc-${TEST_NAME}"
COMMAND "${BASH}" "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh"
"${TS_BASEDIR}"
"${TS_BUILDDIR}"
"${TS_SRCDIR}"
"${TEST_NAME}"
)

set_tests_properties("shoc-${TEST_NAME}"
PROPERTIES
COST 400.0
LABELS "shoc"
)
endforeach()

7 changes: 7 additions & 0 deletions examples/shoc/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

TS_BASEDIR="$1"
TS_BUILDDIR="$2"
TS_SRCDIR="$3"

cd "${TS_SRCDIR}" && make
9 changes: 9 additions & 0 deletions examples/shoc/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

TS_BASEDIR="$1"
TS_BUILDDIR="$2"
TS_SRCDIR="$3"
VIRTUALENV="$4"
PYTH="$5"

cd "${TS_SRCDIR}" && ./configure --with-opencl --without-cuda --without-mpi
7 changes: 7 additions & 0 deletions examples/shoc/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

TS_BASEDIR="$1"
TS_BUILDDIR="$2"
TS_SRCDIR="$3"

cd "${TS_SRCDIR}" && make install
8 changes: 8 additions & 0 deletions examples/shoc/runtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

TS_BASEDIR="$1"
TS_BUILDDIR="$2"
TS_SRCDIR="$3"
TEST_NAME="$4"

cd "${TS_SRCDIR}" && ./bin/shocdriver -opencl -benchmark ${TEST_NAME} -s 4

0 comments on commit a54ec90

Please sign in to comment.