Skip to content

Commit

Permalink
Merge pull request #755 from CamStan/main
Browse files Browse the repository at this point in the history
Merge dev into main for release 1.0.1
  • Loading branch information
adammoody authored Jan 10, 2023
2 parents 6bbb03b + 6a11ec4 commit 59e0438
Show file tree
Hide file tree
Showing 71 changed files with 2,813 additions and 858 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
os: [ ubuntu-20.04 ]
compiler: [ gcc ]
gcc: [ 7, 8, 9, 10, 11 ]

Expand All @@ -37,7 +37,15 @@ jobs:
CXX: g++-${{ matrix.gcc }}

steps:
- uses: actions/checkout@v2
- name: Push checkout
if: github.event_name == 'push'
uses: actions/checkout@v2

- name: PR checkout
if: github.event_name == 'pull_request'
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
Expand Down
6 changes: 4 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ CONFIG = ordered
ACLOCAL_AMFLAGS = -I m4

pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = client/unifyfs.pc \
client/unifyfs-api.pc
pkgconfig_DATA = \
client/unifyfs.pc \
client/unifyfs-api.pc \
client/unifyfs-static.pc

CLEANFILES =

Expand Down
26 changes: 19 additions & 7 deletions client/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if USE_PMPI_WRAPPERS
lib_LTLIBRARIES += libunifyfs_mpi_gotcha.la
endif #USE_PMPI_WRAPPERS

if ENABLE_LD_PRELOAD
lib_LTLIBRARIES += libunifyfs_preload_gotcha.la
endif #ENABLE_LD_PRELOAD

if HAVE_FORTRAN
lib_LTLIBRARIES += libunifyfsf.la
endif #HAVE_FORTRAN
Expand Down Expand Up @@ -40,15 +44,13 @@ CLIENT_COMMON_CPPFLAGS = \

CLIENT_COMMON_CFLAGS = \
$(AM_CFLAGS) \
$(UNIFYFS_COMMON_FLAGS) \
$(MPI_CFLAGS)
$(UNIFYFS_COMMON_FLAGS)

CLIENT_COMMON_LDFLAGS = \
-version-info $(LIBUNIFYFS_LT_VERSION)

CLIENT_COMMON_LIBADD = \
$(UNIFYFS_COMMON_LIBS) \
$(MPI_CLDFLAGS) \
-lm -lrt -lcrypto -lpthread

if HAVE_SPATH
Expand Down Expand Up @@ -96,6 +98,8 @@ PMPI_SRC_FILES = \
pmpi_wrappers.c \
pmpi_wrappers.h

PRELOAD_SRC_FILES = \
preload.c

# Per-target flags begin here

Expand All @@ -118,8 +122,8 @@ libunifyfs_la_SOURCES = \

if USE_PMPI_WRAPPERS
libunifyfs_mpi_la_CPPFLAGS = $(CLIENT_COMMON_CPPFLAGS)
libunifyfs_mpi_la_CFLAGS = $(CLIENT_COMMON_CFLAGS)
libunifyfs_mpi_la_LDFLAGS = $(CLIENT_COMMON_LDFLAGS)
libunifyfs_mpi_la_CFLAGS = $(CLIENT_COMMON_CFLAGS) $(MPI_CFLAGS)
libunifyfs_mpi_la_LDFLAGS = $(CLIENT_COMMON_LDFLAGS) $(MPI_CLDFLAGS)
libunifyfs_mpi_la_LIBADD = libunifyfs.la
libunifyfs_mpi_la_SOURCES = $(PMPI_SRC_FILES)
endif #USE_PMPI_WRAPPERS
Expand All @@ -137,10 +141,18 @@ libunifyfs_gotcha_la_SOURCES = \
$(POSIX_CLIENT_SRC_FILES) \
gotcha_map_unifyfs_list.c

if ENABLE_LD_PRELOAD
libunifyfs_preload_gotcha_la_CPPFLAGS = $(CLIENT_COMMON_CPPFLAGS)
libunifyfs_preload_gotcha_la_CFLAGS = $(CLIENT_COMMON_CFLAGS)
libunifyfs_preload_gotcha_la_LDFLAGS = $(CLIENT_COMMON_LDFLAGS)
libunifyfs_preload_gotcha_la_LIBADD = libunifyfs_gotcha.la
libunifyfs_preload_gotcha_la_SOURCES = $(PRELOAD_SRC_FILES)
endif #ENABLE_LD_PRELOAD

if USE_PMPI_WRAPPERS
libunifyfs_mpi_gotcha_la_CPPFLAGS = $(CLIENT_COMMON_CPPFLAGS)
libunifyfs_mpi_gotcha_la_CFLAGS = $(CLIENT_COMMON_CFLAGS)
libunifyfs_mpi_gotcha_la_LDFLAGS = $(CLIENT_COMMON_LDFLAGS)
libunifyfs_mpi_gotcha_la_CFLAGS = $(CLIENT_COMMON_CFLAGS) $(MPI_CFLAGS)
libunifyfs_mpi_gotcha_la_LDFLAGS = $(CLIENT_COMMON_LDFLAGS) $(MPI_CLDFLAGS)
libunifyfs_mpi_gotcha_la_LIBADD = libunifyfs_gotcha.la
libunifyfs_mpi_gotcha_la_SOURCES = $(PMPI_SRC_FILES)
endif #USE_PMPI_WRAPPERS
Expand Down
115 changes: 103 additions & 12 deletions client/src/client_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,17 +419,41 @@ void service_local_reqs(
/* copy data from local write log into user buffer */
off_t log_offset = ext_log_pos + ext_byte_offset;
size_t nread = 0;
int rc = unifyfs_logio_read(client->state.logio_ctx, log_offset,
cover_length, req_ptr, &nread);
if (rc == UNIFYFS_SUCCESS) {
/* update bytes we have filled in the request buffer */
update_read_req_coverage(req, req_byte_offset, nread);
/* we need to use the logio_ctx from correct client */
logio_context* logio_ctx = NULL;
if (next->client_id == client->state.client_id) {
logio_ctx = client->state.logio_ctx;
} else if (client->logio_ctx_ptrs[next->client_id] != NULL) {
logio_ctx = client->logio_ctx_ptrs[next->client_id];
} else {
LOGERR("local log read failed for offset=%zu size=%zu",
(size_t)log_offset, cover_length);
req->errcode = rc;
size_t shmem_size = 0;
if (client->state.logio_ctx->shmem != NULL) {
shmem_size = client->state.logio_ctx->shmem->size;
}
char* spill_dir = NULL;
if (client->state.logio_ctx->spill_sz > 0) {
spill_dir = client->cfg.logio_spill_dir;
}
unifyfs_logio_init(client->state.app_id,
next->client_id,
shmem_size,
client->state.logio_ctx->spill_sz,
spill_dir,
&client->logio_ctx_ptrs[next->client_id]);
logio_ctx = client->logio_ctx_ptrs[next->client_id];
}
if (NULL != logio_ctx) {
int rc = unifyfs_logio_read(logio_ctx, log_offset,
cover_length, req_ptr, &nread);
if (rc == UNIFYFS_SUCCESS) {
/* update bytes we have filled in the request buffer */
update_read_req_coverage(req, req_byte_offset, nread);
} else {
LOGERR("local log read failed for offset=%zu size=%zu",
(size_t) log_offset, cover_length);
req->errcode = rc;
}
}

/* get the next element in the tree */
next = seg_tree_iter(extents, next);
}
Expand Down Expand Up @@ -560,7 +584,7 @@ static void update_read_req_result(unifyfs_client* client,
*/
int process_gfid_reads(unifyfs_client* client,
read_req_t* in_reqs,
int in_count)
size_t in_count)
{
if (0 == in_count) {
return UNIFYFS_SUCCESS;
Expand Down Expand Up @@ -597,9 +621,76 @@ int process_gfid_reads(unifyfs_client* client,
/* this records the pointer to the temp request array if
* we allocate one, we should free this later if not NULL */
read_req_t* reqs = NULL;
if (client->use_node_local_extents) {
extents_list_t* list = calloc(1, sizeof(struct extents_list));
struct extents_list* cur = list;
int num_request_selected = 0;
for (int i = 0; i < in_count; ++i) {
int fid = unifyfs_fid_from_gfid(client, in_reqs[i].gfid);
/* get meta for this file id */
unifyfs_filemeta_t* meta = unifyfs_get_meta_from_fid(client, fid);
if (meta != NULL) {
if (!meta->attrs.is_laminated || !meta->needs_reads_sync) {
/* do not proceed for this request as
* it is not a laminated file or has already been synced.*/
continue;
}
num_request_selected++;
off_t filesize_offt = unifyfs_gfid_filesize(client,
in_reqs[i].gfid);
cur->value.file_pos = 0;
cur->value.length = filesize_offt - 1;
cur->value.gfid = in_reqs[i].gfid;
if (i < in_count - 1) {
cur->next = calloc(1, sizeof(struct extents_list));
cur->next->next = NULL;
cur = cur->next;
} else {
cur->next = NULL;
}
meta->needs_reads_sync = 0;
}
}
if (num_request_selected > 0) {
/* There are files which are laminated and
* require sync of extents */
size_t extent_count = 0;
unifyfs_client_index_t* extents = NULL;
int rc =
invoke_client_node_local_extents_get_rpc(client,
num_request_selected,
list,
&extent_count,
&extents);
if (rc == UNIFYFS_SUCCESS && extent_count != 0) {
for (int j = 0; j < extent_count; ++j) {
if (extents[j].log_app_id ==
client->state.app_id) {
int fid = unifyfs_fid_from_gfid(client,
extents[j].gfid);
/* get meta for this file id */
unifyfs_filemeta_t* meta = unifyfs_get_meta_from_fid(
client,
fid);
if (meta != NULL) {
seg_tree_add(&meta->extents,
extents[j].file_pos,
extents[j].file_pos +
extents[j].length - 1,
extents[j].log_pos,
extents[j].log_client_id);
}
}
}
}
if (extents != NULL) {
free(extents);
}
}
}

/* attempt to complete requests locally if enabled */
if (client->use_local_extents) {
if (client->use_local_extents || client->use_node_local_extents) {
/* allocate space to make local and server copies of the requests,
* each list will be at most in_count long */
size_t reqs_size = 2 * in_count;
Expand Down Expand Up @@ -743,7 +834,7 @@ int process_gfid_reads(unifyfs_client* client,
/* if we attempted to service requests from our local extent map,
* then we need to copy the resulting read requests from the local
* and server arrays back into the user's original array */
if (client->use_local_extents) {
if (client->use_local_extents || client->use_node_local_extents) {
/* TODO: would be nice to copy these back into the same order
* in which we received them. */

Expand Down
2 changes: 1 addition & 1 deletion client/src/client_read.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ void update_read_req_coverage(read_req_t* req,
/* process a set of client read requests */
int process_gfid_reads(unifyfs_client* client,
read_req_t* in_reqs,
int in_count);
size_t in_count);

#endif // UNIFYFS_CLIENT_READ_H
17 changes: 17 additions & 0 deletions client/src/gotcha_map_unifyfs_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ UNIFYFS_DEF(unlink, int,
UNIFYFS_DEF(remove, int,
(const char* path),
(path))
UNIFYFS_DEF(utimensat, int,
(int dirfd, const char* pathname, const struct timespec times[2],
int flags),
(dirfd, pathname, times, flags))
UNIFYFS_DEF(futimens, int,
(int fd, const struct timespec times[2]),
(fd, times))

UNIFYFS_DEF(stat, int,
(const char* path, struct stat* buf),
Expand Down Expand Up @@ -144,6 +151,12 @@ UNIFYFS_DEF(pwrite64, ssize_t,
UNIFYFS_DEF(close, int,
(int fd),
(fd))
UNIFYFS_DEF(dup, int,
(int fd),
(fd))
UNIFYFS_DEF(dup2, int,
(int fd, int desired_fd),
(fd, desired_fd))
UNIFYFS_DEF(fchdir, int,
(int fd),
(fd))
Expand Down Expand Up @@ -349,6 +362,8 @@ struct gotcha_binding_t unifyfs_wrappers[] = {
{ "truncate", UNIFYFS_WRAP(truncate), &wrappee_handle_truncate },
{ "unlink", UNIFYFS_WRAP(unlink), &wrappee_handle_unlink },
{ "remove", UNIFYFS_WRAP(remove), &wrappee_handle_remove },
{ "utimensat", UNIFYFS_WRAP(utimensat), &wrappee_handle_utimensat },
{ "futimens", UNIFYFS_WRAP(futimens), &wrappee_handle_futimens },
{ "stat", UNIFYFS_WRAP(stat), &wrappee_handle_stat },
{ "fstat", UNIFYFS_WRAP(fstat), &wrappee_handle_fstat },
{ "__xstat", UNIFYFS_WRAP(__xstat), &wrappee_handle___xstat },
Expand Down Expand Up @@ -386,6 +401,8 @@ struct gotcha_binding_t unifyfs_wrappers[] = {
{ "munmap", UNIFYFS_WRAP(munmap), &wrappee_handle_munmap },
{ "mmap64", UNIFYFS_WRAP(mmap64), &wrappee_handle_mmap64 },
{ "close", UNIFYFS_WRAP(close), &wrappee_handle_close },
{ "dup", UNIFYFS_WRAP(dup), &wrappee_handle_dup },
{ "dup2", UNIFYFS_WRAP(dup2), &wrappee_handle_dup2 },
{ "opendir", UNIFYFS_WRAP(opendir), &wrappee_handle_opendir },
{ "fdopendir", UNIFYFS_WRAP(fdopendir), &wrappee_handle_fdopendir },
{ "closedir", UNIFYFS_WRAP(closedir), &wrappee_handle_closedir },
Expand Down
Loading

0 comments on commit 59e0438

Please sign in to comment.