/* Copyright (C) 2014 Francesc Alted http://blosc.org License: MIT (see LICENSE.txt) Example program demonstrating use of the Blosc filter from C code. To compile this program using gcc or clang: gcc/clang multithread.c -o multithread -lblosc -lpthread or, if you don't have the blosc library installed: gcc -O3 -msse2 multithread.c ../blosc/!(*avx2*)*.c -I../blosc -o multithread -lpthread Using MSVC on Windows: cl /Ox /Femultithread.exe /Iblosc multithread.c blosc\*.c To run: $ ./multithread Blosc version info: 1.4.2.dev ($Date:: 2014-07-08 #$) Using 1 threads (previously using 1) Compression: 4000000 -> 158494 (25.2x) Succesful roundtrip! Using 2 threads (previously using 1) Compression: 4000000 -> 158494 (25.2x) Succesful roundtrip! Using 3 threads (previously using 2) Compression: 4000000 -> 158494 (25.2x) Succesful roundtrip! Using 4 threads (previously using 3) Compression: 4000000 -> 158494 (25.2x) Succesful roundtrip! */ #include #include #define SIZE 1000*1000 int main(){ static float data[SIZE]; static float data_out[SIZE]; static float data_dest[SIZE]; int isize = SIZE*sizeof(float), osize = SIZE*sizeof(float); int dsize = SIZE*sizeof(float), csize; int nthreads, pnthreads, i; for(i=0; i %d (%.1fx)\n", isize, csize, (1.*isize) / csize); /* Decompress */ dsize = blosc_decompress(data_out, data_dest, dsize); if (dsize < 0) { printf("Decompression error. Error code: %d\n", dsize); return dsize; } for(i=0;i