Changeset 64
- Timestamp:
- 04/27/10 12:14:45 (3 years ago)
- Location:
- branches/threaded/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/threaded/src/bench.c
r63 r64 141 141 int fd; 142 142 int status; 143 unsigned int size = 128*1024; /* Buffer size */143 unsigned int size = 256*1024; /* Buffer size */ 144 144 unsigned int elsize = 8; /* Datatype size */ 145 145 int rshift = 12; /* For random data */ 146 int nthreads = 1; /* The number of threads */146 int nthreads = 4; /* The number of threads */ 147 147 int doshuffle = 1; /* Shuffle? */ 148 148 unsigned char *orig, *round; … … 260 260 free(dest[i]); 261 261 } 262 263 /* Free blosc resources */ 264 blosc_free_resources(); 265 262 266 return 0; 263 267 } -
branches/threaded/src/blosc.c
r63 r64 842 842 } 843 843 844 845 /* Free possible memory temporaries and thread resources */ 846 void 847 blosc_free_resources(void) 848 { 849 int t, rc; 850 void *status; 851 852 /* Release temporaries */ 853 if (init_temps_done) { 854 release_temporaries(); 855 } 856 857 /* Finish the possible thread pool */ 858 if (nthreads > 1 && init_threads_done) { 859 /* Tell all existing threads to end */ 860 end_threads = 1; 861 rc = pthread_barrier_wait(&barr_init); 862 if (rc != 0 && rc != PTHREAD_BARRIER_SERIAL_THREAD) { 863 exit(-1); 864 } 865 /* Join exiting threads */ 866 for (t=0; t<nthreads; t++) { 867 rc = pthread_join(threads[t], &status); 868 if (rc) { 869 fprintf(stderr, "ERROR; return code from pthread_join() is %d\n", rc); 870 fprintf(stderr, "\tError detail: %s\n", strerror(rc)); 871 exit(-1); 872 } 873 } 874 875 /* Release mutex and condition variable objects */ 876 pthread_mutex_destroy(&count_mutex); 877 878 /* Barriers */ 879 pthread_barrier_destroy(&barr_init); 880 pthread_barrier_destroy(&barr_inter); 881 pthread_barrier_destroy(&barr_finish); 882 883 /* Thread attributes */ 884 pthread_attr_destroy(&ct_attr); 885 886 init_threads_done = 0; 887 end_threads = 0; 888 } 889 } -
branches/threaded/src/blosc.h
r60 r64 29 29 /** 30 30 31 Initialize a pool of threads for compression/decompression. If32 `nthreads` is 1, then the serial version is chosen and a possible33 previous existing pool is ended. Returns the previous number of34 threads.31 Initialize a pool of threads for compression/decompression. If 32 `nthreads` is 1, then the serial version is chosen and a possible 33 previous existing pool is ended. Returns the previous number of 34 threads. 35 35 36 36 */ … … 97 97 blosc_decompress(const void *src, void *dest, size_t dest_size); 98 98 99 100 /** 101 102 Free possible memory temporaries and thread resources. Use this 103 when you are not going to use Blosc for a long while. 104 105 */ 106 107 void 108 blosc_free_resources(void); 109 99 110 #endif
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/images/blosc-logo-small.png)