-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrun.lua
More file actions
60 lines (46 loc) · 1.49 KB
/
run.lua
File metadata and controls
60 lines (46 loc) · 1.49 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
local MPI = require 'MPI'
local buffer = require 'buffer'
local rank = buffer.new_buffer(buffer.sizeof(buffer.int))
local size = buffer.new_buffer(buffer.sizeof(buffer.int))
MPI.Init()
MPI.Comm_rank(MPI.COMM_WORLD, rank)
MPI.Comm_size(MPI.COMM_WORLD, size)
local callback_types = {
"Comm_copy_attr_function",
"Comm_delete_attr_function",
"Datarep_conversion_function",
"Datarep_extent_function",
"Grequest_cancel_function",
"Grequest_free_function",
"Grequest_query_function",
"Type_copy_attr_function",
"Type_delete_attr_function",
"User_function",
"Win_copy_attr_function",
"Win_delete_attr_function",
}
for _,v in ipairs(callback_types) do
local f = MPI[v]()
local mt = debug.getregistry()["MPI::"..v]
assert(debug.getmetatable(f) == mt)
end
local statuses = MPI.Status(100)
local requests = MPI.Request(100)
local comm = MPI.Comm()
assert(type(comm) == 'userdata')
assert(buffer.get_typed(rank, buffer.int, 0) == 0)
assert(buffer.get_typed(size, buffer.int, 0) == 1)
MPI.Finalize()
print(debug.getinfo(1).source, ": All tests passed")
local function example_function()
local MPI = require 'MPI'
local buffer = require 'buffer'
local rank = buffer.new_buffer(buffer.sizeof(buffer.int))
local size = buffer.new_buffer(buffer.sizeof(buffer.int))
MPI.Init()
MPI.Comm_rank(MPI.COMM_WORLD, rank)
MPI.Comm_size(MPI.COMM_WORLD, size)
print(buffer.get_typed(rank, buffer.int, 0))
print(buffer.get_typed(size, buffer.int, 0))
MPI.Finalize()
end