From 68716ebc08fb8617763a6c4a684497ba1f77c170 Mon Sep 17 00:00:00 2001 From: Kai Zhao Date: Thu, 21 Nov 2024 12:11:15 -0500 Subject: [PATCH] bugfix for openmp --- include/SZ3/api/impl/SZImplOMP.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/SZ3/api/impl/SZImplOMP.hpp b/include/SZ3/api/impl/SZImplOMP.hpp index 96d684c9..b2d81a60 100644 --- a/include/SZ3/api/impl/SZImplOMP.hpp +++ b/include/SZ3/api/impl/SZImplOMP.hpp @@ -33,7 +33,7 @@ size_t SZ_compress_OMP(Config &conf, const T *data, uchar *cmpData, size_t cmpCa nThreads = conf.dims[0]; omp_set_num_threads(nThreads); } - // printf("OpenMP threads = %d\n", nThreads); + printf("OpenMP enabled for compression, threads = %d\n", nThreads); compressed_t.resize(nThreads); cmp_size_t.resize(nThreads + 1); cmp_start_t.resize(nThreads + 1); @@ -70,9 +70,9 @@ size_t SZ_compress_OMP(Config &conf, const T *data, uchar *cmpData, size_t cmpCa conf_t[tid] = conf; conf_t[tid].setDims(dims_t.begin(), dims_t.end()); - cmp_size_t[tid] = num_t * sizeof(T); - compressed_t[tid] = static_cast(malloc(cmp_size_t[tid])); - SZ_compress_dispatcher(conf_t[tid], data_t, compressed_t[tid], cmp_size_t[tid]); + size_t cmp_size_cap = 2 * num_t * sizeof(T); + compressed_t[tid] = static_cast(malloc(cmp_size_cap)); + cmp_size_t[tid] = SZ_compress_dispatcher(conf_t[tid], data_t, compressed_t[tid], cmp_size_cap); #pragma omp barrier #pragma omp single @@ -113,7 +113,7 @@ void SZ_decompress_OMP(Config &conf, const uchar *cmpData, size_t cmpSize, T *de int nThreads = 1; read(nThreads, cmpr_data_pos); omp_set_num_threads(nThreads); - // printf("OpenMP threads = %d\n", nThreads); + printf("OpenMP enabled for decompression, threads = %d\n", nThreads); std::vector conf_t(nThreads); for (int i = 0; i < nThreads; i++) {