Browse Source

Query processor name

Peter Colberg 3 years ago
parent
commit
341f69b14a
7 changed files with 25 additions and 0 deletions
  1. 3
    0
      doc/reference.html
  2. 6
    0
      doc/reference.mdwn
  3. 8
    0
      mpi/init.lua
  4. 2
    0
      test/collective.lua
  5. 2
    0
      test/datatype.lua
  6. 2
    0
      test/pointopoint.lua
  7. 2
    0
      test/topology.lua

+ 3
- 0
doc/reference.html View File

@@ -44,6 +44,9 @@
44 44
 <dt><code>mpi.get_version()</code></dt>
45 45
 <dd><p>Returns the major and minor number of the MPI version.</p>
46 46
 </dd>
47
+<dt><code>mpi.get_processor_name()</code></dt>
48
+<dd><p>Returns a string with the name of the processor on which the function was called. The string provides an identification for a specific piece of hardware, for example, the hostname of a node.</p>
49
+</dd>
47 50
 </dl>
48 51
 <h2 id="communicators">Communicators</h2>
49 52
 <dl>

+ 6
- 0
doc/reference.mdwn View File

@@ -19,6 +19,12 @@ Environment
19 19
 
20 20
   : Returns the major and minor number of the MPI version.
21 21
 
22
+`mpi.get_processor_name()`
23
+
24
+  : Returns a string with the name of the processor on which the function was
25
+    called. The string provides an identification for a specific piece of
26
+    hardware, for example, the hostname of a node.
27
+
22 28
 
23 29
 Communicators
24 30
 -------------

+ 8
- 0
mpi/init.lua View File

@@ -68,6 +68,14 @@ do
68 68
   end
69 69
 end
70 70
 
71
+function _M.get_processor_name()
72
+  local buf = char_n(C.MPI_MAX_PROCESSOR_NAME)
73
+  local len = int_1()
74
+  local err = C.MPI_Get_processor_name(buf, len)
75
+  if err ~= C.MPI_SUCCESS then return error(error_string(err)) end
76
+  return ffi.string(buf, len[0])
77
+end
78
+
71 79
 ------------------------------------------------------------------------------
72 80
 -- Communicators.
73 81
 ------------------------------------------------------------------------------

+ 2
- 0
test/collective.lua View File

@@ -15,6 +15,8 @@ local rank, size = comm:rank(), comm:size()
15 15
 
16 16
 if rank == 0 then pcall(require, "luacov") end
17 17
 
18
+print(mpi.get_processor_name())
19
+
18 20
 -- Test barrier.
19 21
 mpi.barrier(comm)
20 22
 

+ 2
- 0
test/datatype.lua View File

@@ -15,6 +15,8 @@ local left, right = (rank-1)%size, (rank+1)%size
15 15
 
16 16
 if rank == 0 then pcall(require, "luacov") end
17 17
 
18
+print(mpi.get_processor_name())
19
+
18 20
 -- Test sequence of elements.
19 21
 do
20 22
   local count = 1000

+ 2
- 0
test/pointopoint.lua View File

@@ -14,6 +14,8 @@ local rank, size = comm:rank(), comm:size()
14 14
 
15 15
 if rank == 0 then pcall(require, "luacov") end
16 16
 
17
+print(mpi.get_processor_name())
18
+
17 19
 -- Test blocking send and receive.
18 20
 do
19 21
   local tag = math.random(0, 32767)

+ 2
- 0
test/topology.lua View File

@@ -17,6 +17,8 @@ local rank, size = comm:rank(), comm:size()
17 17
 
18 18
 if rank == 0 then pcall(require, "luacov") end
19 19
 
20
+print(mpi.get_processor_name())
21
+
20 22
 -- Test querying Cartesian topology information.
21 23
 do
22 24
   local comm = mpi.cart_create(comm, {2, 2, 2}, {true, true, false}, false)

Loading…
Cancel
Save