This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addprocs(1) | |
@everywhere function echo_on_sock(s, N) | |
while true | |
try | |
read(s, Float64, (N,)) | |
write(s, fill(Float64(myid()), N)) | |
catch e | |
#println("closed by remote $e") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addprocs(1) | |
const rr1=RemoteRef() | |
const rr2=RemoteRef(2) | |
@everywhere function do_sendrecv(N, rr1, rr2) | |
myid() == 1 && print("$N : ") | |
if myid() == 1 | |
rr_put = rr2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MPI | |
function do_sendrecv(N) | |
comm = MPI.COMM_WORLD | |
MPI.Barrier(comm) | |
rank = MPI.Comm_rank(comm) | |
size = MPI.Comm_size(comm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
travis_fold:start:system_info | |
[0K[33;1mBuild system information[0m | |
Build language: cpp | |
travis_fold:end:system_info | |
[0K | |
travis_fold:start:git.checkout | |
[0Ktravis_time:start:21ded7df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DArray{T,N,A} <: AbstractArray{T,N} | |
dims::NTuple{N,Int} | |
chunks::Array{RemoteRef,N} | |
pmap::Array{Int,N} # pmap[i]==p ⇒ processor p has piece i | |
indexes::Array{NTuple{N,UnitRange{Int}},N} # indexes held by piece i | |
cuts::Vector{Vector{Int}} # cuts[d][i] = first index of chunk i in dimension d | |
function DArray(dims, chunks, pmap, indexes, cuts) | |
# check invariants | |
if size(chunks) != size(indexes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type DArray{T,N,A} <: AbstractArray{T,N} | |
dims::NTuple{N,Int} | |
chunks::Array{RemoteRef,N} | |
pmap::Array{Int,N} # pmap[i]==p ⇒ processor p has piece i | |
indexes::Array{NTuple{N,UnitRange{Int}},N} # indexes held by piece i | |
cuts::Vector{Vector{Int}} # cuts[d][i] = first index of chunk i in dimension d | |
function DArray(dims, chunks, pmap, indexes, cuts) | |
# check invariants | |
if size(chunks) != size(indexes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const A = randn(1000, 1000); | |
const numx = 10_000; | |
const v = randn(1000, numx); | |
addprocs(4) | |
@sync begin | |
let A2=A, v2=v, numx2=numx | |
for p in workers() | |
@spawnat p global const A = A2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
np = 8 | |
nt = 10000 | |
pids = addprocs(np) | |
using SyncObjects | |
ts = tspace() | |
#Launch processes on each worker that simulates CPU intensive / blocking stuff for a random amount of time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ | |
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: http://docs.julialang.org | |
_ _ _| |_ __ _ | Type "help()" to list help topics | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.3.0-prerelease+1000 (2014-01-15 06:28 UTC) | |
_/ |\__'_|_|_|\__'_| | Commit 714fa07 (0 days old master) | |
|__/ | x86_64-linux-gnu | |
julia> function file_io(secs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Constants valid on Linux | |
const PROT_READ = 0x01 | |
const PROT_WRITE = 0x02 | |
const MAP_SHARED = 0x01 | |
@linux_only const MAP_ANONYMOUS = 0x20 | |
@osx_only const MAP_ANONYMOUS = 0x1000 | |
function anon_mmap(t::Type, n::Int) | |
x = ccall(:mmap, Ptr{Void}, (Ptr{Void}, Csize_t, Cint, Cint, Cint, FileOffset), C_NULL, sizeof(t) * n, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0) |