Commit 1a96aeda authored by Rob Latham's avatar Rob Latham
Browse files

clean shutdown mechanism

politely ask the server to shut down.  maybe we'll get gprof or darshan
logs out of the server, for example.
parent 1a9c643d
......@@ -3,11 +3,15 @@ ACLOCAL_AMFLAGS="-Im4"
AM_CPPFLAGS = -I$(top_srcdir)/include
bin_PROGRAMS = src/provider/bv-server
bin_PROGRAMS = src/provider/bv-server \
src/client/bv-shutdown
src_provider_bv_server_SOURCES = src/provider/server.c
src_provider_bv_server_LDADD = lib/libbv-provider.la
src_client_bv_shutdown_SOURCES = src/client/bv-shutdown.cc
src_client_bv_shutdown_LDADD = lib/libbv-client.la
lib_LTLIBRARIES = lib/libbv-client.la \
lib/libbv-provider.la
......
......@@ -23,8 +23,16 @@ int bv_setchunk(const char *file, ssize_t nbytes);
/* "init" might be a place to pass in distribution information too? */
bv_client_t bv_init(MPI_Comm comm, const char * ssg_statefile);
/* clean up clients. Must be the absolute last routine called */
int bv_finalize(bv_client_t client);
/* 'shutdown' (go ask servers to kindly exit) is sufficiently different from
* 'finalize' (clean up client stuff) that it seemed to warrant its own api
* call. */
int bv_shutdown(bv_client_t client);
/* stateless api: always pass in a file name? */
ssize_t bv_write(bv_client_t client,
......
......@@ -143,6 +143,15 @@ int bv_finalize(bv_client_t client)
return 0;
}
int bv_shutdown(bv_client_t client)
{
int ret =0;
for (auto target : client->targets)
client->engine->shutdown_remote_engine(target);
return ret;
}
// use bulk transfer for the memory description
// the locations in file we will just send over in a list
// - could compress the file locations: they are likely to compress quite well
......
/*
* simple utility to trigger a graceful server shutdown
*
* uh, no credentials checked here so play nicely
*/
#include <bv.h>
int main(int argc, char **argv)
{
int ret = 0;
MPI_Init(&argc, &argv);
bv_client_t client= bv_init(MPI_COMM_SELF, argv[1]);
ret = bv_shutdown(client);
bv_finalize(client);
MPI_Finalize();
return ret;
}
......@@ -67,4 +67,5 @@ int main(int argc, char **argv)
margo_wait_for_finalize(mid);
margo_finalize(mid);
MPI_Finalize();
}
......@@ -41,8 +41,8 @@ RET_VAL=$?
echo "RET_VAL=${RET_VAL}"
# Stop server
echo "kill ${SERVER_PID}"
kill ${SERVER_PID}
echo "src/client/bv-shutdown ${OUT_FILE}.svc"
src/client/bv-shutdown ${OUT_FILE}.svc
# Return result
exit ${RET_VAL}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment