GitLab maintenance scheduled for Tomorrow, 2019-09-24, from 12:00 to 13:00 CT - Services will be unavailable during this time.

Commit c6a98ee3 authored by Matthieu Dorier's avatar Matthieu Dorier

implemented read part of the pipeline

parent 3a2fcd0e
......@@ -34,6 +34,8 @@ set (BUILD_SHARED_LIBS "OFF" CACHE BOOL "Build a shared library")
include (xpkg-import)
find_package (thallium REQUIRED)
xpkg_import_module (margo REQUIRED margo)
xpkg_import_module (abt-io REQUIRED abt-io)
xpkg_import_module (uuid REQUIRED uuid)
add_subdirectory (src)
add_subdirectory (test)
......
......@@ -16,6 +16,7 @@ int main(int argc, char** argv)
char* local_root = argv[2];
char* remote_root = argv[3];
margo_instance_id mid = MARGO_INSTANCE_NULL;
abt_io_instance_id abtio = ABT_IO_INSTANCE_NULL;
remi_client_t remi_clt = REMI_CLIENT_NULL;
remi_provider_handle_t remi_ph = REMI_PROVIDER_HANDLE_NULL;
hg_addr_t svr_addr = HG_ADDR_NULL;
......@@ -34,8 +35,11 @@ int main(int argc, char** argv)
goto error;
}
// initialize ABT-IO
// TODO
// initialize REMI client
ret = remi_client_init(mid, &remi_clt);
ret = remi_client_init(mid, abtio, &remi_clt);
if(ret != REMI_SUCCESS) {
fprintf(stderr, "ERROR: remi_client_init() returned %d\n", ret);
ret = -1;
......@@ -87,7 +91,7 @@ int main(int argc, char** argv)
// migrate the fileset
int status = 0;
ret = remi_fileset_migrate(remi_ph, fileset, remote_root, REMI_REMOVE_SOURCE, &status);
ret = remi_fileset_migrate(remi_ph, fileset, remote_root, REMI_REMOVE_SOURCE, REMI_USE_MMAP, &status);
if(ret != REMI_SUCCESS) {
fprintf(stderr, "ERROR: remi_fileset_migrate() returned %d (status = %d)\n", ret, status);
ret = -1;
......
......@@ -16,6 +16,7 @@ int main(int argc, char** argv)
char* local_root = argv[2];
char* remote_root = argv[3];
margo_instance_id mid = MARGO_INSTANCE_NULL;
abt_io_instance_id abtio = ABT_IO_INSTANCE_NULL;
remi_client_t remi_clt = REMI_CLIENT_NULL;
remi_provider_handle_t remi_ph = REMI_PROVIDER_HANDLE_NULL;
hg_addr_t svr_addr = HG_ADDR_NULL;
......@@ -34,8 +35,11 @@ int main(int argc, char** argv)
goto error;
}
// initialize ABT-IO
abtio = abt_io_init(1);
// initialize REMI client
ret = remi_client_init(mid, &remi_clt);
ret = remi_client_init(mid, abtio, &remi_clt);
if(ret != REMI_SUCCESS) {
fprintf(stderr, "ERROR: remi_client_init() returned %d\n", ret);
ret = -1;
......@@ -87,7 +91,7 @@ int main(int argc, char** argv)
// migrate the fileset
int status = 0;
ret = remi_fileset_migrate(remi_ph, fileset, remote_root, REMI_KEEP_SOURCE, &status);
ret = remi_fileset_migrate(remi_ph, fileset, remote_root, REMI_KEEP_SOURCE, REMI_USE_ABTIO, &status);
if(ret != REMI_SUCCESS) {
fprintf(stderr, "ERROR: remi_fileset_migrate() returned %d\n", ret);
if(ret == REMI_ERR_USER) {
......@@ -106,6 +110,7 @@ finish:
remi_provider_handle_release(remi_ph);
margo_addr_free(mid, svr_addr);
remi_client_finalize(remi_clt);
abt_io_finalize(abtio);
margo_finalize(mid);
return ret;
error:
......
......@@ -38,6 +38,7 @@ int main(int argc, char** argv)
char* listen_addr_str = argv[1];
uint16_t provider_id = 1;
margo_instance_id mid = MARGO_INSTANCE_NULL;
abt_io_instance_id abtio = ABT_IO_INSTANCE_NULL;
remi_provider_t remi_prov = REMI_PROVIDER_NULL;
hg_addr_t my_addr = HG_ADDR_NULL;
......@@ -67,8 +68,11 @@ int main(int argc, char** argv)
margo_addr_free(mid, my_addr);
fprintf(stdout,"Server running at address %s\n", my_addr_str);
// initialize ABT-IO
// TODO
// create the REMI provider
ret = remi_provider_register(mid, 1, REMI_ABT_POOL_DEFAULT, &remi_prov);
ret = remi_provider_register(mid, abtio, 1, REMI_ABT_POOL_DEFAULT, &remi_prov);
if(ret != REMI_SUCCESS) {
fprintf(stderr, "ERROR: remi_provider_register() returned %d\n", ret);
ret = -1;
......
......@@ -7,6 +7,7 @@
#define __REMI_CLIENT_H
#include <remi/remi-common.h>
#include <abt-io.h>
#include <margo.h>
#if defined(__cplusplus)
......@@ -29,11 +30,15 @@ typedef struct remi_provider_handle* remi_provider_handle_t;
* @brief Initializes a REMI client.
*
* @param[in] mid Margo instance.
* @param[in] abtio ABT-IO instance.
* @param[out] client Resulting client.
*
* @return REMI_SUCCESS or error code defined in remi-common.h.
*/
int remi_client_init(margo_instance_id mid, remi_client_t* client);
int remi_client_init(
margo_instance_id mid,
abt_io_instance_id abtio,
remi_client_t* client);
/**
* @brief Finalizes a REMI client.
......@@ -100,7 +105,8 @@ int remi_shutdown_service(remi_client_t client, hg_addr_t addr);
* @param handle Provider handle of the target provider.
* @param fileset Fileset to migrate.
* @param remote_root Root of the fileset when migrated.
* @param flag REMI_REMOVE_SOURCE or REMI_KEEP_SOURCE.
* @param remove_source REMI_REMOVE_SOURCE or REMI_KEEP_SOURCE.
* @param mode REMI_USE_MMAP or REMI_USE_ABTIO.
* @param status Value returned by the user-defined migration callbacks.
*
* @return REMI_SUCCESS or error code defined in remi-common.h.
......@@ -109,7 +115,8 @@ int remi_fileset_migrate(
remi_provider_handle_t handle,
remi_fileset_t fileset,
const char* remote_root,
int flag,
int remove_source,
int mode,
int* status);
#if defined(__cplusplus)
......
......@@ -12,9 +12,12 @@
extern "C" {
#endif
#define REMI_KEEP_SOURCE 0 /* Keep the source files/directories */
#define REMI_KEEP_SOURCE 0 /* Keep the source files/directories */
#define REMI_REMOVE_SOURCE 1 /* Remove the source files/directories */
#define REMI_USE_MMAP 2 /* Use mmap-ed files to issue transfers (good for memory-based storage) */
#define REMI_USE_ABTIO 4 /* Use ABT-IO to pipeline read/write with data transfers (good for disks) */
#define REMI_SUCCESS 0 /* Success */
#define REMI_ERR_ALLOCATION -1 /* Error allocating something */
#define REMI_ERR_INVALID_ARG -2 /* An argument is invalid */
......@@ -29,6 +32,7 @@ extern "C" {
#define REMI_ERR_FILE_EXISTS -11 /* File already exists */
#define REMI_ERR_IO -12 /* Error in I/O (stat, open, etc.) call */
#define REMI_ERR_USER -13 /* User-defined error reported in "status" argument */
#define REMI_ERR_INVALID_OPID -14 /* Invalid UUID operation identifier received */
/**
* @brief Fileset type.
......
......@@ -7,6 +7,7 @@
#define __REMI_SERVER_H
#include <remi/remi-common.h>
#include <abt-io.h>
#if defined(__cplusplus)
extern "C" {
......@@ -34,7 +35,7 @@ typedef struct remi_provider* remi_provider_t;
* not erase its original files. In all cases, the return value of this
* function is propagated back to the source.
*/
typedef int (*remi_migration_callback_t)(remi_fileset_t, void*);
typedef int32_t (*remi_migration_callback_t)(remi_fileset_t, void*);
#define REMI_MIGRATION_CALLBACK_NULL ((remi_migration_callback_t)0)
......@@ -49,6 +50,7 @@ typedef void (*remi_uarg_free_t)(void*);
* automatically destroyed upon finalizing the margo instance.
*
* @param[in] mid Margo instance.
* @param[in] abtio ABT-IO instance. May be ABT_IO_INSTANCE_NULL.
* @param[in] provider_id Provider id.
* @param[in] pool Argobots pool.
* @param[out] provider Resulting provider.
......@@ -57,6 +59,7 @@ typedef void (*remi_uarg_free_t)(void*);
*/
int remi_provider_register(
margo_instance_id mid,
abt_io_instance_id abtio,
uint16_t provider_id,
ABT_pool pool,
remi_provider_t* provider);
......@@ -72,6 +75,7 @@ int remi_provider_register(
* @param[in] mid Margo instance.
* @param[in] provider_id Provider id.
* @param[out] flag 1 if provider is registered, 0 otherwise.
* @param[out] abtio ABT-IO instance used by the provider.
* @param[out] pool Pool used to register the provider.
* @param[out] provider Registered provider (if it exists).
*
......@@ -81,6 +85,7 @@ int remi_provider_registered(
margo_instance_id mid,
uint16_t provider_id,
int* flag,
abt_io_instance_id* abtio,
ABT_pool* pool,
remi_provider_t* provider);
......
......@@ -17,7 +17,7 @@ set (remi-vers "${REMI_VERSION_MAJOR}.${REMI_VERSION_MINOR}")
set (REMI_VERSION "${remi-vers}.${REMI_VERSION_PATCH}")
add_library(remi ${remi-src})
target_link_libraries (remi thallium margo)
target_link_libraries (remi thallium margo abt-io uuid)
target_include_directories (remi PUBLIC $<INSTALL_INTERFACE:include>)
# local include's BEFORE, in case old incompatable .h files in prefix/include
......
This diff is collapsed.
This diff is collapsed.
#ifndef __UUID_UTIL_HPP
#define __UUID_UTIL_HPP
#include <string>
#include <array>
#include <uuid/uuid.h>
#include <thallium/serialization/stl/array.hpp>
class uuid : public std::array<unsigned char,16> {
public:
uuid() {
uuid_t id;
uuid_generate(id);
for(int i=0; i<16; i++) {
(*this)[i] = id[i];
}
}
uuid(const uuid& other) = default;
uuid(uuid&& other) = default;
uuid& operator=(const uuid& other) = default;
uuid& operator=(uuid&& other) = default;
template<typename Archive>
void serialize(Archive& a) {
a & static_cast<std::array<unsigned char,16>&>(*this);
}
template<typename T>
friend T& operator<<(T& stream, const uuid& id);
};
template<typename T>
T& operator<<(T& stream, const uuid& id) {
for(unsigned i=0; i<16; i++) {
stream << (int)id[i] << " ";
}
return stream;
}
struct uuid_hash {
std::size_t operator()(uuid const& id) const noexcept
{
std::string str((char*)(&id[0]), 16);
return std::hash<std::string>()(str);
}
};
#endif
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