Comments (3)
const_array
classes do indeed support private_const_view
, e.g.,
zfp/include/zfp/constarray1.hpp
Line 42 in c4f1756
This is the only way to access a
const_array
in a thread-safe manner. Here's a simple example:
#include <iostream>
#include <omp.h>
#include "zfp/constarray1.hpp"
int main()
{
// initialize 1D array to linear ramp
const size_t n = 100;
double field[n];
for (size_t i = 0; i < n; i++)
field[i] = i;
// initialize fixed-precision const_array, a
zfp::const_array1d a(n, zfp_config_precision(10), field);
// output const_array in parallel
#pragma omp parallel
{
// obtain a thread-safe view, v, of a
zfp::const_array1d::private_const_view v(&a);
// determine loop bounds for this thread
int thread = omp_get_thread_num();
int threads = omp_get_num_threads();
size_t min = (thread + 0) * n / threads;
size_t max = (thread + 1) * n / threads;
// loop over indices assigned to this thread
for (size_t i = min; i < max; i++) {
double val = v(i);
// serialize output
#pragma omp critical
{
std::cout << i << " " << val << std::endl;
}
}
}
return 0;
}
Specifying cache_size=0
merely sets the cache size to its default of roughly √n elements for an array with n elements and is unrelated to thread safety.
from zfp.
I was mistaken, is possible to use the private_const_view
with the const_array
classes
from zfp.
Hello @lindstro thank you detailed reply.
from zfp.
Related Issues (20)
- Python binding installation fails HOT 18
- ppc32: index.hpp: error: integer constant is too large for ‘unsigned long’ type HOT 3
- How to run zfp as a c code with gcc HOT 6
- Is psnr formula error in ZFP? HOT 2
- Missing `void` in functions that take no parameters
- Tiny but above subnormal numbers not handled correctly
- Numpy 2.0 HOT 11
- Cuda mode ZFP examples HOT 4
- Compilation issues with zfp HOT 2
- Running issues with zfp and cuda HOT 3
- Errors reported with scikit-build when running CMake with BUILD_ZFPY enabled HOT 1
- Test failures and segfaults when building with Visual Studio 2022 compiler v14.38.33130 HOT 13
- 2D Point data curiosly compresses way better at 1D HOT 4
- Deserializing const_array HOT 2
- Issue with running the diffusion program in the examples folder HOT 3
- Why strides are ignored in zfp_field_metadata()? HOT 4
- Syntax error in setup.py HOT 1
- Adjusting test cases from mock tests to proper tests for `testZfpCuda4d<datatype>` HOT 3
- example array.cpp error:C4146 Unary minus operator applied to unsigned type, the result is still unsigned. store.hpp 241 HOT 3
- The data is wrong after decompression and decompression by zfp_field_1d, but it is correct when I use zfp_field_2d HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zfp.