Changeset d3261710


Ignore:
Timestamp:
Jan 20, 2022, 11:18:15 AM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
224916b
Parents:
6117fc0 (diff), 6a33e40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/transfer.cfa

    r6117fc0 rd3261710  
    11#include "rq_bench.hfa"
    22#include <fstream.hfa>
     3#include <locale.h>
    34
    45Duration default_preemption() {
     
    89#define PRINT(...)
    910
    10 __lehmer64_state_t lead_seed;
     11__uint128_t lead_seed;
    1112volatile unsigned leader;
    1213volatile size_t lead_idx;
     
    6869        waitgroup();
    6970
    70         unsigned nleader = __lehmer64( lead_seed ) % nthreads;
     71        unsigned nleader = lehmer64( lead_seed ) % nthreads;
    7172        __atomic_store_n( &leader, nleader, __ATOMIC_SEQ_CST );
    7273
     
    105106// ==================================================
    106107int main(int argc, char * argv[]) {
    107         __lehmer64_state_t lead_seed = getpid();
    108         for(10) __lehmer64( lead_seed );
     108        uint64_t lead_seed = getpid();
     109        for(10) lehmer64( lead_seed );
    109110        unsigned nprocs = 2;
    110111
     
    126127
    127128        lead_idx = 0;
    128         leader = __lehmer64( lead_seed ) % nthreads;
     129        leader = lehmer64( lead_seed ) % nthreads;
    129130
    130131        size_t rechecks = 0;
     
    167168        }
    168169
     170        setlocale( LC_NUMERIC, getenv( "LANG" ) );
    169171        sout | "Duration (ms)           : " | ws(3, 3, unit(eng((end - start)`dms)));
    170172        sout | "Number of processors    : " | nprocs;
  • libcfa/src/bits/random.hfa

    r6117fc0 rd3261710  
     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
    116#pragma once
    217
    318#include <stdint.h>
    419
    5 // Pipelined to allow out-of-order overlap with reduced dependencies. Critically, return the current value, and compute
    6 // and store the next value.
     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.
    722
     23#if defined(__SIZEOF_INT128__)
    824//--------------------------------------------------
    9 #if defined(__SIZEOF_INT128__)
    1025        static inline uint64_t lehmer64( __uint128_t & state ) {
    1126                __uint128_t ret = state;
     
    5065} xorwow__state_t;
    5166
    52 /* The state array must be initialized to not be all zero in the first four words */
     67// The state array must be initialized to not be all zero in the first four words.
    5368static inline uint32_t xorwow( xorwow__state_t & state ) {
    54         /* Algorithm "xorwow" from p. 5 of Marsaglia, "Xorshift RNGs" */
     69        // Algorithm "xorwow" from p. 5 of Marsaglia, "Xorshift RNGs".
    5570        uint32_t ret = state.a + state.counter;
    5671        uint32_t t = state.d;
     
    8499#define D  (16_l64u)
    85100
     101// Bi-directional LCG random-number generator
    86102static inline uint32_t LCGBI_fwd( uint64_t & state ) {
    87103        state = (A * state + C) & (M - 1);
  • libcfa/src/iostream.cfa

    r6117fc0 rd3261710  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 17 16:38:32 2022
    13 // Update Count     : 1349
     12// Last Modified On : Wed Jan 19 08:15:53 2022
     13// Update Count     : 1352
    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
    284285          if ( s[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator
    285286
     
    693694                if ( ! f.flags.pc ) memcpy( &fmtstr, DFMTNP, sizeof(DFMTNP) ); \
    694695                else memcpy( &fmtstr, DFMTP, sizeof(DFMTP) ); \
    695                 int star = 4;                                                                   /* position before first '*' */ \
     696                int star = 5;                                                                   /* position before first '*' */ \
    696697\
    697698                /* Insert flags into spaces before '*', from right to left. */ \
     
    699700                if ( f.flags.sign ) { fmtstr[star] = '+'; star -= 1; } \
    700701                if ( f.flags.pad0 ) { fmtstr[star] = '0'; star -= 1; } \
     702                fmtstr[star] = '\''; star -= 1;                                 /* locale */ \
    701703                fmtstr[star] = '%'; \
    702704\
     
    716718} // distribution
    717719
    718 FloatingPointFMTImpl( double, "     * ", "     *.* " )
    719 FloatingPointFMTImpl( long double, "     *L ", "     *.*L " )
     720FloatingPointFMTImpl( double,      "      * ",  "      *.* " )
     721FloatingPointFMTImpl( long double, "      *L ", "      *.*L " )
    720722
    721723// *********************************** character ***********************************
Note: See TracChangeset for help on using the changeset viewer.