Changes in / [d3261710:6117fc0]


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/transfer.cfa

    rd3261710 r6117fc0  
    11#include "rq_bench.hfa"
    22#include <fstream.hfa>
    3 #include <locale.h>
    43
    54Duration default_preemption() {
     
    98#define PRINT(...)
    109
    11 __uint128_t lead_seed;
     10__lehmer64_state_t lead_seed;
    1211volatile unsigned leader;
    1312volatile size_t lead_idx;
     
    6968        waitgroup();
    7069
    71         unsigned nleader = lehmer64( lead_seed ) % nthreads;
     70        unsigned nleader = __lehmer64( lead_seed ) % nthreads;
    7271        __atomic_store_n( &leader, nleader, __ATOMIC_SEQ_CST );
    7372
     
    106105// ==================================================
    107106int 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 );
    110109        unsigned nprocs = 2;
    111110
     
    127126
    128127        lead_idx = 0;
    129         leader = lehmer64( lead_seed ) % nthreads;
     128        leader = __lehmer64( lead_seed ) % nthreads;
    130129
    131130        size_t rechecks = 0;
     
    168167        }
    169168
    170         setlocale( LC_NUMERIC, getenv( "LANG" ) );
    171169        sout | "Duration (ms)           : " | ws(3, 3, unit(eng((end - start)`dms)));
    172170        sout | "Number of processors    : " | nprocs;
  • libcfa/src/bits/random.hfa

    rd3261710 r6117fc0  
    1 //
    2 // Cforall Version 1.0.0 Copyright (C) 2022 University of Waterloo
    3 //
    4 // The contents of this file are covered under the licence agreement in the
    5 // file "LICENCE" distributed with Cforall.
    6 //
    7 // random.hfa --
    8 //
    9 // Author           : Peter A. Buhr
    10 // Created On       : Fri Jan 14 07:18:11 2022
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jan 14 07:18:58 2022
    13 // Update Count     : 1
    14 //
    15 
    161#pragma once
    172
    183#include <stdint.h>
    194
    20 // Pipelined to allow out-of-order overlap with reduced dependencies. Critically, the current random state is returned
    21 // (copied), and then compute and store the next random value.
     5// Pipelined to allow out-of-order overlap with reduced dependencies. Critically, return the current value, and compute
     6// and store the next value.
    227
     8//--------------------------------------------------
    239#if defined(__SIZEOF_INT128__)
    24 //--------------------------------------------------
    2510        static inline uint64_t lehmer64( __uint128_t & state ) {
    2611                __uint128_t ret = state;
     
    6550} xorwow__state_t;
    6651
    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 */
    6853static 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" */
    7055        uint32_t ret = state.a + state.counter;
    7156        uint32_t t = state.d;
     
    9984#define D  (16_l64u)
    10085
    101 // Bi-directional LCG random-number generator
    10286static inline uint32_t LCGBI_fwd( uint64_t & state ) {
    10387        state = (A * state + C) & (M - 1);
  • libcfa/src/iostream.cfa

    rd3261710 r6117fc0  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 19 08:15:53 2022
    13 // Update Count     : 1352
     12// Last Modified On : Mon Jan 17 16:38:32 2022
     13// Update Count     : 1349
    1414//
    1515
     
    205205        ostype & ?|?( ostype & os, float f ) {
    206206                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    207                 PrintWithDP( os, "%'g", f );
     207                PrintWithDP( os, "%g", f );
    208208                return os;
    209209        } // ?|?
     
    214214        ostype & ?|?( ostype & os, double d ) {
    215215                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    216                 PrintWithDP( os, "%'.*lg", d, DBL_DIG );
     216                PrintWithDP( os, "%.*lg", d, DBL_DIG );
    217217                return os;
    218218        } // ?|?
     
    223223        ostype & ?|?( ostype & os, long double ld ) {
    224224                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    225                 PrintWithDP( os, "%'.*Lg", ld, LDBL_DIG );
     225                PrintWithDP( os, "%.*Lg", ld, LDBL_DIG );
    226226                return os;
    227227        } // ?|?
     
    233233                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    234234//              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 ) );
    237237                fmt( os, "i" );
    238238                return os;
     
    245245                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    246246//              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 );
    249249                fmt( os, "i" );
    250250                return os;
     
    257257                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    258258//              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 );
    261261                fmt( os, "i" );
    262262                return os;
     
    282282                }; // mask
    283283
    284           if ( s == 0p ) { fmt( os, "%s", "0p" ); return os; } // null pointer
    285284          if ( s[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator
    286285
     
    694693                if ( ! f.flags.pc ) memcpy( &fmtstr, DFMTNP, sizeof(DFMTNP) ); \
    695694                else memcpy( &fmtstr, DFMTP, sizeof(DFMTP) ); \
    696                 int star = 5;                                                                   /* position before first '*' */ \
     695                int star = 4;                                                                   /* position before first '*' */ \
    697696\
    698697                /* Insert flags into spaces before '*', from right to left. */ \
     
    700699                if ( f.flags.sign ) { fmtstr[star] = '+'; star -= 1; } \
    701700                if ( f.flags.pad0 ) { fmtstr[star] = '0'; star -= 1; } \
    702                 fmtstr[star] = '\''; star -= 1;                                 /* locale */ \
    703701                fmtstr[star] = '%'; \
    704702\
     
    718716} // distribution
    719717
    720 FloatingPointFMTImpl( double,      "      * ",  "      *.* " )
    721 FloatingPointFMTImpl( long double, "      *L ", "      *.*L " )
     718FloatingPointFMTImpl( double, "     * ", "     *.* " )
     719FloatingPointFMTImpl( long double, "     *L ", "     *.*L " )
    722720
    723721// *********************************** character ***********************************
Note: See TracChangeset for help on using the changeset viewer.