Skip to content

Commit 94c0644

Browse files
committed
优化GPU加速代码
1 parent b79bdd6 commit 94c0644

File tree

4 files changed

+3
-3
lines changed

4 files changed

+3
-3
lines changed

C++/cudaAccelerator/cudaAccelerator/dllmain.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -990,8 +990,8 @@ void create_and_insert_cache(const std::vector<std::string>& records_vec, const
990990
cache->str_data.str_total_bytes = alloc_bytes;
991991
cache->str_data.str_remain_blank_bytes = CACHE_REMAIN_BLANK_SIZE_IN_BYTES;
992992

993-
auto str_addr_capacity = record_count + CACHE_REMAIN_BLANK_SIZE_IN_BYTES / MAX_PATH_LENGTH;
994-
auto str_addr_alloc_size = str_addr_capacity * sizeof(size_t);
993+
const auto str_addr_capacity = record_count + CACHE_REMAIN_BLANK_SIZE_IN_BYTES / MAX_PATH_LENGTH;
994+
const auto str_addr_alloc_size = str_addr_capacity * sizeof(size_t);
995995
gpuErrchk(cudaMalloc(&cache->str_data.dev_str_addr, str_addr_alloc_size), true, nullptr);
996996
gpuErrchk(cudaMemset(cache->str_data.dev_str_addr, 0, str_addr_alloc_size), true, nullptr);
997997
cache->str_data.str_addr_capacity = str_addr_capacity;

C++/openclAccelerator/src/file_utils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ std::wstring string2wstring(const std::string& str)
2525
int is_dir_or_file(const char* path)
2626
{
2727
const auto w_path = string2wstring(path);
28-
DWORD dwAttrib = GetFileAttributes(w_path.c_str());
28+
const DWORD dwAttrib = GetFileAttributes(w_path.c_str());
2929
if (dwAttrib != INVALID_FILE_ATTRIBUTES)
3030
{
3131
if (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)