1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """
24 low-level tools for PVM
25 """
26
27 import pvm
28 import pypvm_core
29 import os
30 import Biskit.hosts as H
31
32
34 """
35 Expand name of local(!) host.
36 For example, turn 'myhost' into 'myhost.mydomain.com'
37
38 @param host: host name
39 @type host: str
40
41 @return: full host name
42 @rtype: str
43 """
44 if os.uname()[1].split('.')[0] == host:
45 return os.uname()[1]
46
47 return host
48
49
51 """
52 Add hosts to PVM.
53
54 @param number: number of requested nodes
55 if number == 0, nothing happens
56 @type number: int
57 @param hosts: list of host names
58 @type hosts: [str]
59 @param expand: add full address to local node
60 @type expand: [1|0]
61 """
62 if expand:
63 hosts = [ expandLocal( h ) for h in hosts ]
64
65 if number == None:
66 pvm.addHosts( hosts )
67
68 if number > 0:
69 pvm.addHosts( hosts[:number+1] )
70
71
73 """
74 @return: number of hosts registered with PVM
75 @rtype: int
76 """
77 return PVM.pypvm_core.config()[0]
78
79
80 pvmerrors = {
81 0 : 'PvmOk Success',
82 -2 : 'PvmBadParam Bad parameter',
83 -3 : 'PvmMismatch Parameter mismatch',
84 -4 : 'PvmOverflow Value too large',
85 -5 : 'PvmNoData End of buffer',
86 -6 : 'PvmNoHost No such host',
87 -7 : 'PvmNoFile No such file',
88 -8 : 'PvmDenied Permission denied',
89 -10: 'PvmNoMem Malloc failed',
90 -12: "PvmBadMsg Can't decode message",
91 -14: "PvmSysErr Can't contact local daemon",
92 -15: 'PvmNoBuf No current buffer',
93 -16: 'PvmNoSuchBuf No such buffer',
94 -17: 'PvmNullGroup Null group name',
95 -18: 'PvmDupGroup Already in group',
96 -19: 'PvmNoGroup No such group',
97 -20: 'PvmNotInGroup Not in group',
98 -21: 'PvmNoInst No such instance',
99 -22: 'PvmHostFail Host failed',
100 -23: 'PvmNoParent No parent task',
101 -24: 'PvmNotImpl Not implemented',
102 -25: 'PvmDSysErr Pvmd system error',
103 -26: 'PvmBadVersion Version mismatch',
104 -27: 'PvmOutOfRes Out of resources',
105 -28: 'PvmDupHost Duplicate host',
106 -29: "PvmCantStart Can't start pvmd",
107 -30: 'PvmAlready Already in progress',
108 -31: 'PvmNoTask No such task',
109 -32: 'PvmNotFound Not Found',
110 -33: 'PvmExists Already exists',
111 -34: 'PvmHostrNMstr Hoster run on non-master host',
112 -35: 'PvmParentNotSet Spawning parent set PvmNoSpawnParent',
113 -36: "PvmIPLoopback Master Host's IP is Loopback"
114 }
115