Changes in / [d3261710:6117fc0]
- Files:
-
- 3 edited
-
benchmark/readyQ/transfer.cfa (modified) (6 diffs)
-
libcfa/src/bits/random.hfa (modified) (3 diffs)
-
libcfa/src/iostream.cfa (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/readyQ/transfer.cfa
rd3261710 r6117fc0 1 1 #include "rq_bench.hfa" 2 2 #include <fstream.hfa> 3 #include <locale.h>4 3 5 4 Duration default_preemption() { … … 9 8 #define PRINT(...) 10 9 11 __ uint128_t lead_seed;10 __lehmer64_state_t lead_seed; 12 11 volatile unsigned leader; 13 12 volatile size_t lead_idx; … … 69 68 waitgroup(); 70 69 71 unsigned nleader = lehmer64( lead_seed ) % nthreads;70 unsigned nleader = __lehmer64( lead_seed ) % nthreads; 72 71 __atomic_store_n( &leader, nleader, __ATOMIC_SEQ_CST ); 73 72 … … 106 105 // ================================================== 107 106 int main(int argc, char * argv[]) { 108 uint64_t lead_seed = getpid();109 for(10) lehmer64( lead_seed );107 __lehmer64_state_t lead_seed = getpid(); 108 for(10) __lehmer64( lead_seed ); 110 109 unsigned nprocs = 2; 111 110 … … 127 126 128 127 lead_idx = 0; 129 leader = lehmer64( lead_seed ) % nthreads;128 leader = __lehmer64( lead_seed ) % nthreads; 130 129 131 130 size_t rechecks = 0; … … 168 167 } 169 168 170 setlocale( LC_NUMERIC, getenv( "LANG" ) );171 169 sout | "Duration (ms) : " | ws(3, 3, unit(eng((end - start)`dms))); 172 170 sout | "Number of processors : " | nprocs; -
libcfa/src/bits/random.hfa
rd3261710 r6117fc0 1 //2 // Cforall Version 1.0.0 Copyright (C) 2022 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // random.hfa --8 //9 // Author : Peter A. Buhr10 // Created On : Fri Jan 14 07:18:11 202211 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Jan 14 07:18:58 202213 // Update Count : 114 //15 16 1 #pragma once 17 2 18 3 #include <stdint.h> 19 4 20 // Pipelined to allow out-of-order overlap with reduced dependencies. Critically, the current random state is returned21 // (copied), and then compute and store the next randomvalue.5 // Pipelined to allow out-of-order overlap with reduced dependencies. Critically, return the current value, and compute 6 // and store the next value. 22 7 8 //-------------------------------------------------- 23 9 #if defined(__SIZEOF_INT128__) 24 //--------------------------------------------------25 10 static inline uint64_t lehmer64( __uint128_t & state ) { 26 11 __uint128_t ret = state; … … 65 50 } xorwow__state_t; 66 51 67 / / The state array must be initialized to not be all zero in the first four words.52 /* The state array must be initialized to not be all zero in the first four words */ 68 53 static inline uint32_t xorwow( xorwow__state_t & state ) { 69 / / Algorithm "xorwow" from p. 5 of Marsaglia, "Xorshift RNGs".54 /* Algorithm "xorwow" from p. 5 of Marsaglia, "Xorshift RNGs" */ 70 55 uint32_t ret = state.a + state.counter; 71 56 uint32_t t = state.d; … … 99 84 #define D (16_l64u) 100 85 101 // Bi-directional LCG random-number generator102 86 static inline uint32_t LCGBI_fwd( uint64_t & state ) { 103 87 state = (A * state + C) & (M - 1); -
libcfa/src/iostream.cfa
rd3261710 r6117fc0 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 19 08:15:53202213 // Update Count : 13 5212 // Last Modified On : Mon Jan 17 16:38:32 2022 13 // Update Count : 1349 14 14 // 15 15 … … 205 205 ostype & ?|?( ostype & os, float f ) { 206 206 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 207 PrintWithDP( os, "% 'g", f );207 PrintWithDP( os, "%g", f ); 208 208 return os; 209 209 } // ?|? … … 214 214 ostype & ?|?( ostype & os, double d ) { 215 215 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 216 PrintWithDP( os, "% '.*lg", d, DBL_DIG );216 PrintWithDP( os, "%.*lg", d, DBL_DIG ); 217 217 return os; 218 218 } // ?|? … … 223 223 ostype & ?|?( ostype & os, long double ld ) { 224 224 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 225 PrintWithDP( os, "% '.*Lg", ld, LDBL_DIG );225 PrintWithDP( os, "%.*Lg", ld, LDBL_DIG ); 226 226 return os; 227 227 } // ?|? … … 233 233 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 234 234 // os | crealf( fc ) | nonl; 235 PrintWithDP( os, "% 'g", crealf( fc ) );236 PrintWithDP( os, "% '+g", cimagf( fc ) );235 PrintWithDP( os, "%g", crealf( fc ) ); 236 PrintWithDP( os, "%+g", cimagf( fc ) ); 237 237 fmt( os, "i" ); 238 238 return os; … … 245 245 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 246 246 // os | creal( dc ) | nonl; 247 PrintWithDP( os, "% '.*lg", creal( dc ), DBL_DIG );248 PrintWithDP( os, "% '+.*lg", cimag( dc ), DBL_DIG );247 PrintWithDP( os, "%.*lg", creal( dc ), DBL_DIG ); 248 PrintWithDP( os, "%+.*lg", cimag( dc ), DBL_DIG ); 249 249 fmt( os, "i" ); 250 250 return os; … … 257 257 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 258 258 // os | creall( ldc ) || nonl; 259 PrintWithDP( os, "% '.*Lg", creall( ldc ), LDBL_DIG );260 PrintWithDP( os, "% '+.*Lg", cimagl( ldc ), LDBL_DIG );259 PrintWithDP( os, "%.*Lg", creall( ldc ), LDBL_DIG ); 260 PrintWithDP( os, "%+.*Lg", cimagl( ldc ), LDBL_DIG ); 261 261 fmt( os, "i" ); 262 262 return os; … … 282 282 }; // mask 283 283 284 if ( s == 0p ) { fmt( os, "%s", "0p" ); return os; } // null pointer285 284 if ( s[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator 286 285 … … 694 693 if ( ! f.flags.pc ) memcpy( &fmtstr, DFMTNP, sizeof(DFMTNP) ); \ 695 694 else memcpy( &fmtstr, DFMTP, sizeof(DFMTP) ); \ 696 int star = 5; /* position before first '*' */ \695 int star = 4; /* position before first '*' */ \ 697 696 \ 698 697 /* Insert flags into spaces before '*', from right to left. */ \ … … 700 699 if ( f.flags.sign ) { fmtstr[star] = '+'; star -= 1; } \ 701 700 if ( f.flags.pad0 ) { fmtstr[star] = '0'; star -= 1; } \ 702 fmtstr[star] = '\''; star -= 1; /* locale */ \703 701 fmtstr[star] = '%'; \ 704 702 \ … … 718 716 } // distribution 719 717 720 FloatingPointFMTImpl( double, " * ", "*.* " )721 FloatingPointFMTImpl( long double, " *L ", "*.*L " )718 FloatingPointFMTImpl( double, " * ", " *.* " ) 719 FloatingPointFMTImpl( long double, " *L ", " *.*L " ) 722 720 723 721 // *********************************** character ***********************************
Note:
See TracChangeset
for help on using the changeset viewer.