mirror of
https://github.com/openstreetmap/mod_tile.git
synced 2025-07-25 15:04:30 +00:00
Add option to detect available cores when num_threads=-1 (#380)
When configuring `num_threads=-1` in `renderd.conf` for a `renderd` section, the value will be set to the number of cores on the running system.
This commit is contained in:
@ -11,6 +11,9 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
include(CTest)
|
||||
include(ProcessorCount)
|
||||
|
||||
processorcount(PROCESSOR_COUNT)
|
||||
|
||||
execute_process(COMMAND ${APXS_EXECUTABLE} -q progname
|
||||
OUTPUT_VARIABLE HTTPD_PROGNAME
|
||||
@ -635,6 +638,28 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})
|
||||
set_tests_properties(stats_urls_${STORAGE_BACKEND} PROPERTIES
|
||||
FIXTURES_REQUIRED "services_started_${STORAGE_BACKEND};tiles_downloaded_${STORAGE_BACKEND}"
|
||||
)
|
||||
if(NOT PROCESSOR_COUNT EQUAL 0)
|
||||
# Set CTEST_NUM_SLAVE_THREADS to 5 (renderd1 = 1, renderd2 = 4 [NUM_THREADS])
|
||||
set(CTEST_NUM_SLAVE_THREADS 5)
|
||||
add_test(
|
||||
NAME renderd_num_threads_${STORAGE_BACKEND}
|
||||
COMMAND ${BASH} -c "
|
||||
if ! ${GREP_EXECUTABLE} -q \"config renderd: num_threads=${PROCESSOR_COUNT}\" \"${RENDERD0_LOG}\"; then
|
||||
${GREP_EXECUTABLE} \"config renderd: num_threads=\" \"${RENDERD0_LOG}\"
|
||||
exit 1;
|
||||
fi
|
||||
if ! ${GREP_EXECUTABLE} -q \"config renderd: num_slave_threads=${CTEST_NUM_SLAVE_THREADS}\" \"${RENDERD0_LOG}\"; then
|
||||
${GREP_EXECUTABLE} \"config renderd: num_slave_threads=\" \"${RENDERD0_LOG}\"
|
||||
exit 1;
|
||||
fi
|
||||
"
|
||||
WORKING_DIRECTORY tests
|
||||
)
|
||||
set_tests_properties(renderd_num_threads_${STORAGE_BACKEND} PROPERTIES
|
||||
FIXTURES_REQUIRED services_started_${STORAGE_BACKEND}
|
||||
REQUIRED_FILES ${RENDERD0_LOG}
|
||||
)
|
||||
endif()
|
||||
add_test(
|
||||
NAME stop_services_${STORAGE_BACKEND}
|
||||
COMMAND ${BASH} -c "
|
||||
|
@ -42,11 +42,13 @@ XML=@PROJECT_SOURCE_DIR@/utils/example-map/mapnik.xml
|
||||
[renderd1]
|
||||
iphostname=@RENDERD1_HOST@
|
||||
ipport=@RENDERD1_PORT@
|
||||
num_threads=1
|
||||
pid_file=@RENDERD1_PID@
|
||||
stats_file=@TEST_RUN_DIR@/renderd1_@STORAGE_BACKEND@.stats
|
||||
tile_dir=@TILE_DIR@
|
||||
|
||||
[renderd0]
|
||||
num_threads=-1
|
||||
pid_file=@RENDERD0_PID@
|
||||
socketname=@RENDERD0_SOCKET@
|
||||
stats_file=@TEST_RUN_DIR@/renderd0_@STORAGE_BACKEND@.stats
|
||||
|
Reference in New Issue
Block a user