Skip to content

Commit

Permalink
Fix CMakeLists so that collective check are run with make test
Browse files Browse the repository at this point in the history
- Add gpucomm helper function test case
- Fix Makefile
  • Loading branch information
tsirif committed Jun 23, 2016
1 parent 90b5164 commit 0df266a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 28 deletions.
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,46 @@ Debug:

Debug/Makefile: Debug config
ifndef INSTALL_PREFIX
cd Debug && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Debug
(cd Debug && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Debug)
else
cd Debug && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
(cd Debug && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX))
endif

debugc: Debug/Makefile
cd Debug && make
(cd Debug && make)

test-debugc: debugc
ifndef DEVICE
cd Debug && make test
(cd Debug && make test)
else
cd Debug && DEVICE=${DEVICE} make test
(cd Debug && DEVICE=${DEVICE} make test)
endif

install-debugc: test-debugc
cd Debug && ${SUDO} make install
install-debugc: debugc
(cd Debug && ${SUDO} make install)

Release:
mkdir Release

Release/Makefile: Release config
ifndef INSTALL_PREFIX
cd Release && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Release
(cd Release && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Release)
else
cd Release && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
(cd Release && NUM_DEVS=${NUM_DEVS} DEV_NAMES=${DEV_NAMES} cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX))
endif

relc: Release/Makefile
cd Release && make
(cd Release && make)

test-relc: relc
ifndef DEVICE
cd Release && make test
(cd Release && make test)
else
cd Release && DEVICE=${DEVICE} make test
(cd Release && DEVICE=${DEVICE} make test)
endif

install-relc: test-relc
cd Release && ${SUDO} make install
install-relc: relc
(cd Release && ${SUDO} make install)

py: config
python setup.py build_ext --inplace
1 change: 1 addition & 0 deletions Makefile.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ DEVICE=
# Set to empty if you want to use default (1 gpu)
NUM_DEVS=
# Set to devices you want to use for multi-gpu tests
# Use a string of space separated device names, e.g. DEV_NAMES="cuda0 cuda1"
# Set to empty if you want to use defaults (cuda device)
DEV_NAMES=
29 changes: 15 additions & 14 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}")

add_executable(check_types main.c check_types.c)
target_link_libraries(check_types ${CHECK_LIBRARIES} gpuarray)
add_test(test_types ${CMAKE_CURRENT_BINARY_DIR}/check_types)
add_test(test_types "${CMAKE_CURRENT_BINARY_DIR}/check_types")

add_executable(check_util main.c check_util.c)
target_link_libraries(check_util ${CHECK_LIBRARIES} gpuarray)
add_test(test_util ${CMAKE_CURRENT_BINARY_DIR}/check_util)
add_test(test_util "${CMAKE_CURRENT_BINARY_DIR}/check_util")

add_executable(check_array main.c device.c check_array.c)
target_link_libraries(check_array ${CHECK_LIBRARIES} gpuarray)
add_test(test_array ${CMAKE_CURRENT_BINARY_DIR}/check_array)
add_test(test_array "${CMAKE_CURRENT_BINARY_DIR}/check_array")

add_executable(check_elemwise main.c device.c check_elemwise.c)
target_link_libraries(check_elemwise ${CHECK_LIBRARIES} gpuarray)
add_test(test_elemwise ${CMAKE_CURRENT_BINARY_DIR}/check_elemwise)
add_test(test_elemwise "${CMAKE_CURRENT_BINARY_DIR}/check_elemwise")

add_executable(check_error main.c check_error.c)
target_link_libraries(check_error ${CHECK_LIBRARIES} gpuarray)
add_test(test_error ${CMAKE_CURRENT_BINARY_DIR}/check_error)
add_test(test_error "${CMAKE_CURRENT_BINARY_DIR}/check_error")

add_executable(check_buffer main.c device.c check_buffer.c)
target_link_libraries(check_buffer ${CHECK_LIBRARIES} gpuarray)
add_test(test_buffer ${CMAKE_CURRENT_BINARY_DIR}/check_buffer)
add_test(test_buffer "${CMAKE_CURRENT_BINARY_DIR}/check_buffer")

if(BUILD_WITH_COLLECTIVES)

Expand Down Expand Up @@ -95,15 +95,16 @@ if(BUILD_WITH_COLLECTIVES)

set(_DEV_NAMES $ENV{DEV_NAMES})
if(NOT _DEV_NAMES)
set(_DEV_NAMES cuda)
set(_DEV_NAMES "cuda")
endif()

# add_test(NAME test_buffer_collectives
# COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${_NUM_DEVS}
# ${MPIEXEC_PREFLAGS} ${CMAKE_CURRENT_BINARY_DIR}/check_buffer_collectives ${MPIEXEC_POSTFLAGS} ${_DEV_NAMES})
# add_test(NAME test_collectives
# COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${_NUM_DEVS}
# ${MPIEXEC_PREFLAGS} ${CMAKE_CURRENT_BINARY_DIR}/check_collectives ${MPIEXEC_POSTFLAGS} ${_DEV_NAMES})
separate_arguments(_DEV_NAMES)

add_test(NAME test_buffer_collectives
COMMAND "${MPIEXEC}" ${MPIEXEC_NUMPROC_FLAG} ${_NUM_DEVS} ${MPIEXEC_PREFLAGS}
"${CMAKE_CURRENT_BINARY_DIR}/check_buffer_collectives" ${MPIEXEC_POSTFLAGS} ${_DEV_NAMES})
add_test(NAME test_collectives
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${_NUM_DEVS} ${MPIEXEC_PREFLAGS}
"${CMAKE_CURRENT_BINARY_DIR}/check_collectives" ${MPIEXEC_POSTFLAGS} ${_DEV_NAMES})

else(MPI_C_FOUND)

Expand Down
6 changes: 6 additions & 0 deletions tests/check_buffer_collectives.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ TEST_ALL_GATHER_FAIL(elemcount, (size_t)INT_MAX + 1, GA_INT, 0, 0,
Suite* get_suite(void) {
Suite* s = suite_create("buffer_collectives_API");

TCase* helps = tcase_create("test_helpers");
tcase_add_unchecked_fixture(helps, setup_comm, teardown_comm);
tcase_add_test(helps, test_gpucomm_get_count);
tcase_add_test(helps, test_gpucomm_get_rank);

TCase* reds = tcase_create("test_reduce");
tcase_add_unchecked_fixture(reds, setup_comm, teardown_comm);
tcase_add_test(reds, test_gpucomm_reduce_INT_SUM);
Expand Down Expand Up @@ -673,6 +678,7 @@ Suite* get_suite(void) {
tcase_add_test(agatf, test_gpucomm_all_gather_fail_dest_offset);
tcase_add_test(agatf, test_gpucomm_all_gather_fail_elemcount);

suite_add_tcase(s, helps);
suite_add_tcase(s, reds);
suite_add_tcase(s, redf);
suite_add_tcase(s, areds);
Expand Down

0 comments on commit 0df266a

Please sign in to comment.