One syntax to write parallel algorithms.
This syntax comes from the observation that arrays are representation of sequences, but sequences could be represented by linkded list or trees.
In this case, if we draw a tree like this:
Use nimscripter with libssh to compile a code that uploads itself and a script to a server than run it.
Make a portable remote commander.
type | |
OpCode = enum | |
LOAD_IMME_IMMEDI_32_BITS = (000, "LOAD_IMME | SIZE_32 | IMMEDI = 0x00"), | |
LOAD_SRC_IMMEDI_32_BITS = (001, "LOAD_SRC | SIZE_32 | IMMEDI = 0x01"), | |
STORE_IMME_IMMEDI_32_BITS = (002, "STORE_IMME | SIZE_32 | IMMEDI = 0x02"), | |
STORE_SRC_IMMEDI_32_BITS = (003, "STORE_SRC | SIZE_32 | IMMEDI = 0x03"), | |
ADD_IMM_32_BITS = (004, "ADD | IMM | MATH_32 = 0x04"), | |
GO_TO_IMM = (005, "GO_TO | IMM | JUMP_64 = 0x05"), | |
ADD_IMM_64_BITS = (007, "ADD | IMM | MATH_64 = 0x07"), | |
LOAD_IMME_IMMEDI_16_BITS = (008, "LOAD_IMME | SIZE_16 | IMMEDI = 0x08"), |
Identity | Closed | Pure | Associative | Commutative | Feature | |
---|---|---|---|---|---|---|
NoOP | ✅ | ✅ | ✅ | early return of X | ||
Memoise | ✅ | early return cache | ||||
Idempotent | early return cache | |||||
Map | No need to define | |||||
Reduce | ✅ | No need to define | ||||
ParMap | ✅ | Parallel Map | ||||
ParReduce | ✅ |
import std/[macros, monotimes, strformat, strutils, times] | |
# source | |
# https://github.com/timotheecour/Nim/blob/94a32119cb5eeeff2a825dc29cbbe60accb6432e/lib/std/cputicks.nim | |
##[ | |
Experimental API, subject to change. | |
]## | |
#[ |
subversion-1.14.2/subversion/libsvn_subr/user.c: apr_env_get(... "HOME" ...) | |
subversion-1.14.2/subversion/libsvn_subr/cmdline.c: apr_env_get(... "SVN_EDITOR" ...) | |
subversion-1.14.2/subversion/libsvn_subr/cmdline.c: apr_env_get(... "VISUAL" ...) | |
subversion-1.14.2/subversion/libsvn_subr/cmdline.c: apr_env_get(... "EDITOR" ...) | |
subversion-1.14.2/subversion/svn/util.c: apr_env_get(... "SVN_MERGE" ...) |
# Requires: cassandra wrapper https://github.com/yglukhov/cassandra | |
# | |
# Expect a query from stdin | |
# printf "SELECT cql_version FROM system.local"|./cascli | |
# | |
# Fist parameter is config file name, default is clascli.ini | |
# Example: | |
# [cassandra] | |
# ips=127.0.0.1 | |
# user=cass_user |
OP | T0E0 | T0E1 | T1E0 | T1E1 | T2E0 | T0E1-T0E0 | T1E0-T0E1 | ||
---|---|---|---|---|---|---|---|---|---|
count | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | |
mean | 88 | 60161 | 60196 | 83309 | 83346 | 119640 | 35 | 23149 | |
std | 49 | 158756 | 158759 | 203086 | 203090 | 301369 | 17 | 67967 | |
min | 42 | 1238 | 1267 | 3385 | 3412 | 5622 | 23 | 866 | |
25% | 60 | 5089 | 5118 | 10852 | 10882 | 16680 | 25 | 2020 | |
50% | 73 | 13457 | 13485 | 23656 | 23685 | 30790 | 30 | 4886 | |
75% | 94 | 32269 | 32302 | 55943 | 55978 | 94389 | 38 | 13003 | |
max | 295 | 999287 | 999349 | 1570617 | 1570679 | 2244872 | 128 | 571330 |
OP | T0E0 | T0E1 | T1E0 | T1E1 | T2E0 | T0E1-T0E0 | T1E0-T0E1 | |
---|---|---|---|---|---|---|---|---|
53 | 20051 | 20141 | 21110 | 21162 | 21489 | 90 | 1021 | |
38 | 9689 | 9807 | 10563 | 10622 | 11029 | 118 | 815 | |
40 | 33800 | 33857 | 34065 | 34103 | 34310 | 57 | 246 | |
60 | 11960 | 12000 | 12304 | 12344 | 12524 | 40 | 344 | |
39 | 24083 | 24123 | 24413 | 24453 | 24632 | 40 | 330 | |
41 | 10385 | 10535 | 11253 | 11309 | 11496 | 150 | 774 | |
40 | 20820 | 20877 | 21188 | 21245 | 22507 | 57 | 368 | |
39 | 9352 | 9392 | 9776 | 9815 | 9992 | 40 | 423 | |
41 | 21047 | 21086 | 21463 | 21505 | 21682 | 39 | 419 |
count | mean | std | min | 25% | 50% | 75% | max | ||
---|---|---|---|---|---|---|---|---|---|
Setup | 1000 | 83 | 36 | 54 | 76 | 78 | 83 | 668 | |
Serial | 1000 | 28 | 5 | 22 | 25 | 26 | 30 | 106 | |
Spwn0000E0 - Epoch | 1000 | 7505 | 5537 | 2999 | 4156 | 6041 | 10329 | 111353 | |
Spwn0001E0 - Epoch | 1000 | 8931 | 5624 | 3574 | 5349 | 8424 | 11697 | 112437 | |
Spwn0002E0 - Epoch | 1000 | 9988 | 5694 | 3945 | 6388 | 9635 | 12703 | 113501 | |
Spwn0003E0 - Epoch | 1000 | 10930 | 5793 | 4007 | 7318 | 10755 | 13671 | 113359 | |
Spwn0004E0 - Epoch | 1000 | 12146 | 6002 | 5510 | 8388 | 12125 | 14658 | 118282 | |
Spwn0005E0 - Epoch | 1000 | 14336 | 6379 | 6325 | 10317 | 14129 | 16290 | 119504 | |
Spwn0006E0 - Epoch | 1000 | 16807 | 7572 | 8382 | 12575 | 16036 | 18738 | 125174 |