Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
margo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
sds
margo
Commits
17f8c22d
Commit
17f8c22d
authored
Apr 04, 2016
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update to reflect HG API changes
- na_ and NA_ types and functions no longer necessary
parent
6be169d8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
128 deletions
+33
-128
examples/client-timeout.c
examples/client-timeout.c
+5
-30
examples/client.c
examples/client.c
+5
-30
examples/server-hang.c
examples/server-hang.c
+1
-22
examples/server.c
examples/server.c
+1
-22
include/margo.h
include/margo.h
+4
-6
src/margo.c
src/margo.c
+17
-18
No files found.
examples/client-timeout.c
View file @
17f8c22d
...
...
@@ -24,8 +24,6 @@ struct run_my_rpc_args
{
int
val
;
margo_instance_id
mid
;
na_class_t
*
network_class
;
na_context_t
*
na_context
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
};
...
...
@@ -46,34 +44,17 @@ int main(int argc, char **argv)
margo_instance_id
mid
;
ABT_xstream
progress_xstream
;
ABT_pool
progress_pool
;
na_class_t
*
network_class
;
na_context_t
*
na_context
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
na_addr_t
svr_addr
=
NA
_ADDR_NULL
;
hg_addr_t
svr_addr
=
HG
_ADDR_NULL
;
hg_handle_t
handle
;
/* boilerplate HG initialization steps */
/***************************************/
network_class
=
NA_Initialize
(
"tcp://localhost:1234"
,
NA_FALSE
);
if
(
!
network_class
)
{
fprintf
(
stderr
,
"Error: NA_Initialize()
\n
"
);
return
(
-
1
);
}
na_context
=
NA_Context_create
(
network_class
);
if
(
!
na_context
)
{
fprintf
(
stderr
,
"Error: NA_Context_create()
\n
"
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_class
=
HG_Init
(
network_class
,
na_context
);
hg_class
=
HG_Init
(
"tcp://localhost:1234"
,
HG_FALSE
);
if
(
!
hg_class
)
{
fprintf
(
stderr
,
"Error: HG_Init()
\n
"
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_context
=
HG_Context_create
(
hg_class
);
...
...
@@ -81,8 +62,6 @@ int main(int argc, char **argv)
{
fprintf
(
stderr
,
"Error: HG_Context_create()
\n
"
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
...
...
@@ -146,8 +125,6 @@ int main(int argc, char **argv)
args
[
i
].
mid
=
mid
;
args
[
i
].
hg_class
=
hg_class
;
args
[
i
].
hg_context
=
hg_context
;
args
[
i
].
na_context
=
na_context
;
args
[
i
].
network_class
=
network_class
;
/* Each fiber gets a pointer to an element of the array to use
* as input for the run_my_rpc() function.
...
...
@@ -183,7 +160,7 @@ int main(int argc, char **argv)
/* send one rpc to server to shut it down */
/* find addr for server */
ret
=
margo_
na_addr_lookup
(
mid
,
network_class
,
na
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
ret
=
margo_
addr_lookup
(
mid
,
hg
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
assert
(
ret
==
0
);
/* create handle */
...
...
@@ -202,8 +179,6 @@ int main(int argc, char **argv)
HG_Context_destroy
(
hg_context
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
0
);
}
...
...
@@ -211,7 +186,7 @@ int main(int argc, char **argv)
static
void
run_my_rpc
(
void
*
_arg
)
{
struct
run_my_rpc_args
*
arg
=
_arg
;
na_addr_t
svr_addr
=
NA
_ADDR_NULL
;
hg_addr_t
svr_addr
=
HG
_ADDR_NULL
;
hg_handle_t
handle
;
my_rpc_in_t
in
;
my_rpc_out_t
out
;
...
...
@@ -229,7 +204,7 @@ static void run_my_rpc(void *_arg)
sprintf
((
char
*
)
buffer
,
"Hello world!
\n
"
);
/* find addr for server */
ret
=
margo_
na_addr_lookup
(
arg
->
mid
,
arg
->
network_class
,
arg
->
na
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
ret
=
margo_
addr_lookup
(
arg
->
mid
,
arg
->
hg
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
assert
(
ret
==
0
);
/* create handle */
...
...
examples/client.c
View file @
17f8c22d
...
...
@@ -24,8 +24,6 @@ struct run_my_rpc_args
{
int
val
;
margo_instance_id
mid
;
na_class_t
*
network_class
;
na_context_t
*
na_context
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
};
...
...
@@ -46,34 +44,17 @@ int main(int argc, char **argv)
margo_instance_id
mid
;
ABT_xstream
progress_xstream
;
ABT_pool
progress_pool
;
na_class_t
*
network_class
;
na_context_t
*
na_context
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
na_addr_t
svr_addr
=
NA
_ADDR_NULL
;
hg_addr_t
svr_addr
=
HG
_ADDR_NULL
;
hg_handle_t
handle
;
/* boilerplate HG initialization steps */
/***************************************/
network_class
=
NA_Initialize
(
"tcp://localhost:1234"
,
NA_FALSE
);
if
(
!
network_class
)
{
fprintf
(
stderr
,
"Error: NA_Initialize()
\n
"
);
return
(
-
1
);
}
na_context
=
NA_Context_create
(
network_class
);
if
(
!
na_context
)
{
fprintf
(
stderr
,
"Error: NA_Context_create()
\n
"
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_class
=
HG_Init
(
network_class
,
na_context
);
hg_class
=
HG_Init
(
"tcp://localhost:1234"
,
HG_FALSE
);
if
(
!
hg_class
)
{
fprintf
(
stderr
,
"Error: HG_Init()
\n
"
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_context
=
HG_Context_create
(
hg_class
);
...
...
@@ -81,8 +62,6 @@ int main(int argc, char **argv)
{
fprintf
(
stderr
,
"Error: HG_Context_create()
\n
"
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
...
...
@@ -146,8 +125,6 @@ int main(int argc, char **argv)
args
[
i
].
mid
=
mid
;
args
[
i
].
hg_class
=
hg_class
;
args
[
i
].
hg_context
=
hg_context
;
args
[
i
].
na_context
=
na_context
;
args
[
i
].
network_class
=
network_class
;
/* Each fiber gets a pointer to an element of the array to use
* as input for the run_my_rpc() function.
...
...
@@ -183,7 +160,7 @@ int main(int argc, char **argv)
/* send one rpc to server to shut it down */
/* find addr for server */
ret
=
margo_
na_addr_lookup
(
mid
,
network_class
,
na
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
ret
=
margo_
addr_lookup
(
mid
,
hg
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
assert
(
ret
==
0
);
/* create handle */
...
...
@@ -202,8 +179,6 @@ int main(int argc, char **argv)
HG_Context_destroy
(
hg_context
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
0
);
}
...
...
@@ -211,7 +186,7 @@ int main(int argc, char **argv)
static
void
run_my_rpc
(
void
*
_arg
)
{
struct
run_my_rpc_args
*
arg
=
_arg
;
na_addr_t
svr_addr
=
NA
_ADDR_NULL
;
hg_addr_t
svr_addr
=
HG
_ADDR_NULL
;
hg_handle_t
handle
;
my_rpc_in_t
in
;
my_rpc_out_t
out
;
...
...
@@ -229,7 +204,7 @@ static void run_my_rpc(void *_arg)
sprintf
((
char
*
)
buffer
,
"Hello world!
\n
"
);
/* find addr for server */
ret
=
margo_
na_addr_lookup
(
arg
->
mid
,
arg
->
network_class
,
arg
->
na
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
ret
=
margo_
addr_lookup
(
arg
->
mid
,
arg
->
hg
_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
assert
(
ret
==
0
);
/* create handle */
...
...
examples/server-hang.c
View file @
17f8c22d
...
...
@@ -27,8 +27,6 @@ int main(int argc, char **argv)
margo_instance_id
mid
;
ABT_xstream
handler_xstream
;
ABT_pool
handler_pool
;
na_class_t
*
network_class
;
na_context_t
*
na_context
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
...
...
@@ -40,25 +38,10 @@ int main(int argc, char **argv)
/* boilerplate HG initialization steps */
/***************************************/
network_class
=
NA_Initialize
(
"tcp://localhost:1234"
,
NA_TRUE
);
if
(
!
network_class
)
{
fprintf
(
stderr
,
"Error: NA_Initialize()
\n
"
);
return
(
-
1
);
}
na_context
=
NA_Context_create
(
network_class
);
if
(
!
na_context
)
{
fprintf
(
stderr
,
"Error: NA_Context_create()
\n
"
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_class
=
HG_Init
(
network_class
,
na_context
);
hg_class
=
HG_Init
(
"tcp://localhost:1234"
,
HG_TRUE
);
if
(
!
hg_class
)
{
fprintf
(
stderr
,
"Error: HG_Init()
\n
"
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_context
=
HG_Context_create
(
hg_class
);
...
...
@@ -66,8 +49,6 @@ int main(int argc, char **argv)
{
fprintf
(
stderr
,
"Error: HG_Context_create()
\n
"
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
...
...
@@ -143,8 +124,6 @@ int main(int argc, char **argv)
HG_Context_destroy
(
hg_context
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
0
);
}
...
...
examples/server.c
View file @
17f8c22d
...
...
@@ -25,8 +25,6 @@ int main(int argc, char **argv)
ABT_pool
handler_pool
;
ABT_xstream
progress_xstream
;
ABT_pool
progress_pool
;
na_class_t
*
network_class
;
na_context_t
*
na_context
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
int
single_pool_mode
=
0
;
...
...
@@ -52,25 +50,10 @@ int main(int argc, char **argv)
/* boilerplate HG initialization steps */
/***************************************/
network_class
=
NA_Initialize
(
"tcp://localhost:1234"
,
NA_TRUE
);
if
(
!
network_class
)
{
fprintf
(
stderr
,
"Error: NA_Initialize()
\n
"
);
return
(
-
1
);
}
na_context
=
NA_Context_create
(
network_class
);
if
(
!
na_context
)
{
fprintf
(
stderr
,
"Error: NA_Context_create()
\n
"
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_class
=
HG_Init
(
network_class
,
na_context
);
hg_class
=
HG_Init
(
"tcp://localhost:1234"
,
HG_TRUE
);
if
(
!
hg_class
)
{
fprintf
(
stderr
,
"Error: HG_Init()
\n
"
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
hg_context
=
HG_Context_create
(
hg_class
);
...
...
@@ -78,8 +61,6 @@ int main(int argc, char **argv)
{
fprintf
(
stderr
,
"Error: HG_Context_create()
\n
"
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
-
1
);
}
...
...
@@ -169,8 +150,6 @@ int main(int argc, char **argv)
HG_Context_destroy
(
hg_context
);
HG_Finalize
(
hg_class
);
NA_Context_destroy
(
network_class
,
na_context
);
NA_Finalize
(
network_class
);
return
(
0
);
}
...
...
include/margo.h
View file @
17f8c22d
...
...
@@ -120,7 +120,7 @@ hg_return_t margo_bulk_transfer(
margo_instance_id
mid
,
hg_context_t
*
context
,
hg_bulk_op_t
op
,
na
_addr_t
origin_addr
,
hg
_addr_t
origin_addr
,
hg_bulk_t
origin_handle
,
size_t
origin_offset
,
hg_bulk_t
local_handle
,
...
...
@@ -129,17 +129,15 @@ hg_return_t margo_bulk_transfer(
/**
* address lookup
* @param [in] na_class pointer to NA class
* @param [in] context pointer to context of execution
* @param [in] name lookup name
* @returns NA_SUCCESS on on success
*/
na_return_t
margo_na
_addr_lookup
(
hg_return_t
margo
_addr_lookup
(
margo_instance_id
mid
,
na_class_t
*
na_class
,
na_context_t
*
context
,
hg_context_t
*
context
,
const
char
*
name
,
na
_addr_t
*
addr
);
hg
_addr_t
*
addr
);
/**
* Retrive the Margo instance that has been associated with a Mercury class
...
...
src/margo.c
View file @
17f8c22d
...
...
@@ -415,10 +415,10 @@ hg_return_t margo_respond(
}
static
hg_return_t
margo_bulk_transfer_cb
(
const
struct
hg_
bulk_cb_info
*
hg_bulk_cb_
info
)
static
hg_return_t
margo_bulk_transfer_cb
(
const
struct
hg_
cb_info
*
info
)
{
hg_return_t
hret
=
hg_bulk_cb_
info
->
ret
;
ABT_eventual
*
eventual
=
hg_bulk_cb_
info
->
arg
;
hg_return_t
hret
=
info
->
ret
;
ABT_eventual
*
eventual
=
info
->
arg
;
/* propagate return code out through eventual */
ABT_eventual_set
(
*
eventual
,
&
hret
,
sizeof
(
hret
));
...
...
@@ -428,33 +428,32 @@ static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_
struct
lookup_cb_evt
{
na
_return_t
nret
;
na
_addr_t
addr
;
hg
_return_t
nret
;
hg
_addr_t
addr
;
};
static
na_return_t
margo_na_addr_lookup_cb
(
const
struct
na_cb_info
*
callback_
info
)
static
hg_return_t
margo_addr_lookup_cb
(
const
struct
hg_cb_info
*
info
)
{
struct
lookup_cb_evt
evt
;
evt
.
nret
=
callback_
info
->
ret
;
evt
.
addr
=
callback_
info
->
info
.
lookup
.
addr
;
evt
.
nret
=
info
->
ret
;
evt
.
addr
=
info
->
info
.
lookup
.
addr
;
ABT_eventual
*
eventual
=
callback_
info
->
arg
;
ABT_eventual
*
eventual
=
info
->
arg
;
/* propagate return code out through eventual */
ABT_eventual_set
(
*
eventual
,
&
evt
,
sizeof
(
evt
));
return
(
NA
_SUCCESS
);
return
(
HG
_SUCCESS
);
}
na_return_t
margo_na
_addr_lookup
(
hg_return_t
margo
_addr_lookup
(
margo_instance_id
mid
,
na_class_t
*
na_class
,
na_context_t
*
context
,
hg_context_t
*
context
,
const
char
*
name
,
na
_addr_t
*
addr
)
hg
_addr_t
*
addr
)
{
na
_return_t
nret
;
hg
_return_t
nret
;
struct
lookup_cb_evt
*
evt
;
ABT_eventual
eventual
;
int
ret
;
...
...
@@ -465,8 +464,8 @@ na_return_t margo_na_addr_lookup(
return
(
HG_NOMEM_ERROR
);
}
nret
=
NA_Addr_lookup
(
na_class
,
context
,
margo_na
_addr_lookup_cb
,
&
eventual
,
name
,
NA
_OP_ID_IGNORE
);
nret
=
HG_Addr_lookup
(
context
,
margo
_addr_lookup_cb
,
&
eventual
,
name
,
HG
_OP_ID_IGNORE
);
if
(
nret
==
0
)
{
ABT_eventual_wait
(
eventual
,
(
void
**
)
&
evt
);
...
...
@@ -483,7 +482,7 @@ hg_return_t margo_bulk_transfer(
margo_instance_id
mid
,
hg_context_t
*
context
,
hg_bulk_op_t
op
,
na
_addr_t
origin_addr
,
hg
_addr_t
origin_addr
,
hg_bulk_t
origin_handle
,
size_t
origin_offset
,
hg_bulk_t
local_handle
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment