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
13
Issues
13
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
dd73bca0
Commit
dd73bca0
authored
Nov 13, 2015
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port client example to margo
parent
31262ab9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
45 deletions
+18
-45
examples/Makefile.subdir
examples/Makefile.subdir
+2
-2
examples/client.c
examples/client.c
+15
-42
examples/my-rpc.h
examples/my-rpc.h
+1
-1
No files found.
examples/Makefile.subdir
View file @
dd73bca0
...
...
@@ -3,9 +3,9 @@ bin_PROGRAMS += examples/client examples/server
examples_client_SOURCES
=
\
examples/client.c
\
examples/my-rpc.c
examples_client_LDADD
=
src/lib
hg
argo.a
examples_client_LDADD
=
src/lib
m
argo.a
examples_server_SOURCES
=
\
examples/server.c
\
examples/my-rpc.c
examples_server_LDADD
=
src/lib
hg
argo.a
examples_server_LDADD
=
src/lib
m
argo.a
examples/client.c
View file @
dd73bca0
...
...
@@ -8,8 +8,9 @@
#include <assert.h>
#include <unistd.h>
#include <abt.h>
#include <abt-snoozer.h>
#include <margo.h>
#include "hgargo.h"
#include "my-rpc.h"
/* This is an example client program that issues 4 concurrent RPCs, each of
...
...
@@ -31,10 +32,6 @@ int main(int argc, char **argv)
int
ret
;
ABT_xstream
xstream
;
ABT_pool
pool
;
ABT_sched
sched
;
ABT_pool_def
pool_def
;
struct
hgargo_sched_data
*
sched_data
;
struct
hgargo_pool_data
*
pool_data
;
ret
=
ABT_init
(
argc
,
argv
);
if
(
ret
!=
0
)
...
...
@@ -43,53 +40,29 @@ int main(int argc, char **argv)
return
(
-
1
);
}
ret
=
ABT_xstream_self
(
&
xstream
);
if
(
ret
!=
0
)
/* set primary ES to idle without polling */
ret
=
ABT_snoozer_xstream_self_set
();
{
fprintf
(
stderr
,
"Error: ABT_
xstream_self
()
\n
"
);
fprintf
(
stderr
,
"Error: ABT_
snoozer_xstream_self_set
()
\n
"
);
return
(
-
1
);
}
ret
=
hgargo_pool_get_def
(
ABT_POOL_ACCESS_MPMC
,
&
pool_def
);
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"Error: hgargo_pool_get_def()
\n
"
);
return
(
-
1
);
}
ret
=
ABT_pool_create
(
&
pool_def
,
ABT_POOL_CONFIG_NULL
,
&
pool
);
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"Error: ABT_pool_create()
\n
"
);
return
(
-
1
);
}
hgargo_create_scheds
(
1
,
&
pool
,
&
sched
);
ABT_sched_get_data
(
sched
,
(
void
**
)(
&
sched_data
));
ABT_pool_get_data
(
pool
,
(
void
**
)(
&
pool_data
));
ret
=
hgargo_setup_ev
(
&
sched_data
->
ev
);
if
(
ret
<
0
)
/* retrieve current pool to use for ULT creation */
ret
=
ABT_xstream_self
(
&
xstream
);
{
fprintf
(
stderr
,
"Error:
hgargo_setup_ev
()
\n
"
);
fprintf
(
stderr
,
"Error:
ABT_xstream_self
()
\n
"
);
return
(
-
1
);
}
pool_data
->
ev
=
sched_data
->
ev
;
ABT_sched_set_data
(
sched
,
sched_data
);
ABT_pool_set_data
(
pool
,
pool_data
);
ret
=
ABT_xstream_set_main_sched
(
xstream
,
sched
);
if
(
ret
!=
0
)
ret
=
ABT_xstream_get_main_pools
(
xstream
,
1
,
&
pool
);
{
fprintf
(
stderr
,
"Error: ABT_xstream_
set_main_sched
()
\n
"
);
fprintf
(
stderr
,
"Error: ABT_xstream_
get_main_pools
()
\n
"
);
return
(
-
1
);
}
/* initialize
* note: address here is really just being used to identify transport
*/
hg
argo_init
(
NA_FALSE
,
"tcp://localhost:1234"
);
m
argo_init
(
NA_FALSE
,
"tcp://localhost:1234"
);
/* register RPC */
my_rpc_id
=
my_rpc_register
();
...
...
@@ -129,7 +102,7 @@ int main(int argc, char **argv)
}
}
hg
argo_finalize
();
m
argo_finalize
();
ABT_finalize
();
return
(
0
);
...
...
@@ -156,11 +129,11 @@ static void run_my_rpc(void *_arg)
sprintf
((
char
*
)
buffer
,
"Hello world!
\n
"
);
/* find addr for server */
ret
=
hg
argo_addr_lookup
(
"tcp://localhost:1234"
,
&
svr_addr
);
ret
=
m
argo_addr_lookup
(
"tcp://localhost:1234"
,
&
svr_addr
);
assert
(
ret
==
0
);
/* create handle */
ret
=
hg
argo_create_handle
(
svr_addr
,
my_rpc_id
,
&
handle
);
ret
=
m
argo_create_handle
(
svr_addr
,
my_rpc_id
,
&
handle
);
assert
(
ret
==
0
);
/* register buffer for rdma/bulk access by server */
...
...
@@ -174,7 +147,7 @@ static void run_my_rpc(void *_arg)
* input struct. It was set above.
*/
in
.
input_val
=
*
((
int
*
)(
_arg
));
hg
argo_forward
(
handle
,
&
in
);
m
argo_forward
(
handle
,
&
in
);
/* decode response */
ret
=
HG_Get_output
(
handle
,
&
out
);
...
...
examples/my-rpc.h
View file @
dd73bca0
...
...
@@ -7,7 +7,7 @@
#ifndef __MY_RPC
#define __MY_RPC
#include
"hgargo.h"
#include
<margo.h>
/* visible API for example RPC operation */
...
...
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