Rename CPUThreadPool() to GetCpuThreadPool()

This commit is contained in:
Antoine Pitrou committed 2018-05-23 20:59:43 +02:00
1 parent d4eb8d47c8
commit 616697551d
8 files changed
+16 -16

No files matched your search

+1 -1
View File
@@ -1457,7 +1457,7 @@ class DataFrameBlockCreator {
return block->Write(this->table_->column(i), i, this->column_block_placement_[i]);
};
arrow::internal::ThreadPool* pool = arrow::internal::CPUThreadPool();
arrow::internal::ThreadPool* pool = arrow::internal::GetCpuThreadPool();
std::vector<std::future<Status>> futures;
for (int i = 0; i < table_->num_columns(); ++i) {
futures.push_back(pool->Submit(WriteColumn, i));
+1 -1
View File
@@ -36,7 +36,7 @@ uint8_t* pointer_logical_and(const uint8_t* address, uintptr_t bits) {
void parallel_memcopy(uint8_t* dst, const uint8_t* src, int64_t nbytes,
uintptr_t block_size, int num_threads) {
// XXX This function is really using `num_threads + 1` threads.
auto pool = CPUThreadPool();
auto pool = GetCpuThreadPool();
uint8_t* left = pointer_logical_and(src + block_size - 1, ~(block_size - 1));
uint8_t* right = pointer_logical_and(src + nbytes, ~(block_size - 1));
+2 -2
View File
@@ -284,11 +284,11 @@ TEST_F(TestThreadPool, Submit) {
TEST(TestGlobalThreadPool, Capacity) {
// Sanity check
auto pool = CPUThreadPool();
auto pool = GetCpuThreadPool();
size_t capacity = pool->GetCapacity();
ASSERT_GT(capacity, 0);
ASSERT_EQ(pool->GetActualCapacity(), capacity);
ASSERT_EQ(GetCPUThreadPoolCapacity(), capacity);
ASSERT_EQ(GetCpuThreadPoolCapacity(), capacity);
// Exercise default capacity heuristic
ASSERT_OK(DelEnvVar("OMP_NUM_THREADS"));
+4 -4
View File
@@ -214,17 +214,17 @@ static std::shared_ptr<ThreadPool> MakePoolWithDefaultCapacity() {
return pool;
}
ThreadPool* CPUThreadPool() {
ThreadPool* GetCpuThreadPool() {
static std::shared_ptr<ThreadPool> singleton = MakePoolWithDefaultCapacity();
return singleton.get();
}
} // namespace internal
size_t GetCPUThreadPoolCapacity() { return internal::CPUThreadPool()->GetCapacity(); }
size_t GetCpuThreadPoolCapacity() { return internal::GetCpuThreadPool()->GetCapacity(); }
Status SetCPUThreadPoolCapacity(size_t threads) {
return internal::CPUThreadPool()->SetCapacity(threads);
Status SetCpuThreadPoolCapacity(size_t threads) {
return internal::GetCpuThreadPool()->SetCapacity(threads);
}
} // namespace arrow
+3 -3
View File
@@ -39,11 +39,11 @@ namespace arrow {
// Get the number of worker threads used by the process-global thread pool
// for CPU-bound tasks. This is an idealized number, the actual number
// may lag a bit.
ARROW_EXPORT size_t GetCPUThreadPoolCapacity();
ARROW_EXPORT size_t GetCpuThreadPoolCapacity();
// Set the number of worker threads used by the process-global thread pool
// for CPU-bound tasks.
ARROW_EXPORT Status SetCPUThreadPoolCapacity(size_t threads);
ARROW_EXPORT Status SetCpuThreadPoolCapacity(size_t threads);
namespace internal {
@@ -154,7 +154,7 @@ class ARROW_EXPORT ThreadPool {
};
// Return the process-global thread pool for CPU-bound tasks.
ARROW_EXPORT ThreadPool* CPUThreadPool();
ARROW_EXPORT ThreadPool* GetCpuThreadPool();
} // namespace internal
} // namespace arrow
+1 -1
View File
@@ -698,7 +698,7 @@ bool PlasmaClient::Impl::compute_object_hash_parallel(XXH64_state_t* hash_state,
int64_t nbytes) {
// Note that this function will likely be faster if the address of data is
// aligned on a 64-byte boundary.
auto pool = arrow::internal::CPUThreadPool();
auto pool = arrow::internal::GetCpuThreadPool();
const int num_threads = kHashingConcurrency;
uint64_t threadhash[num_threads + 1];
+2 -2
View File
@@ -1048,5 +1048,5 @@ cdef extern from 'arrow/util/compression.h' namespace 'arrow' nogil:
cdef extern from 'arrow/util/thread-pool.h' namespace 'arrow' nogil:
size_t GetCPUThreadPoolCapacity()
CStatus SetCPUThreadPoolCapacity(size_t threads)
size_t GetCpuThreadPoolCapacity()
CStatus SetCpuThreadPoolCapacity(size_t threads)
+2 -2
View File
@@ -46,7 +46,7 @@ def cpu_count():
is present, it will default to the number of hardware threads on the
system. It can be modified at runtime by calling set_cpu_count().
"""
return GetCPUThreadPoolCapacity()
return GetCpuThreadPoolCapacity()
def set_cpu_count(size_t count):
@@ -55,7 +55,7 @@ def set_cpu_count(size_t count):
"""
if count < 1:
raise ValueError("CPU count must be strictly positive")
check_status(SetCPUThreadPoolCapacity(count))
check_status(SetCpuThreadPoolCapacity(count))
Type_NA = _Type_NA