-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparallel.back
More file actions
73 lines (38 loc) · 1.01 KB
/
parallel.back
File metadata and controls
73 lines (38 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Distributed
num_cores=4
server_specs=("root@192.168.1.2",num_cores)
machines=Vector{typeof(server_specs)}(undef,1)
machines[1]=server_specs
node_working_dir="/home/red/Desktop/Julia_Workspaces/sig_proc"
server_pids=addprocs(machines,max_parallel=20,dir=node_working_dir)
@fetch myid()
using SharedArrays
s_arr=SharedArray{Float32}(1,init=false,workers())
@everywhere [2] begin
f(x)=2*x
ff(x)=3*x
end
@fetchfrom 2
@everywhere [3] x=5
@spawnat 2 for i in 1:10^4 end
arr=[Complex(i,j) for i=rand(100),j=rand(100)]
fft([Complex(i,j) for i=rand(100),j=rand(100)])
f(x)=2*x
x=5
put!(RemoteChannel(2),f(x))
put!(RemoteChannel(3),f(x))
for i in workers()
print("Result from: ")
print(i)
print(" -->> ")
println(remotecall_fetch(f,i,i))
end
fetch(@spawnat 2 f(x))
## Calculating factorial on all nodes
for i in workers()
print("Result from: ")
print(i)
print(" -->> ")
println(remotecall_fetch(factorial,i,i))
end
put!(RemoteChannel(2), ff(x)=3*x)