Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a9b78fd
Add pdc_logger.h to installation (#245)
TheAssembler1 Apr 8, 2025
abaf753
sync with gitlab (#248)
jeanbez Apr 8, 2025
e08d826
Fix restart issue (#228)
houjun Apr 15, 2025
a93223d
Fix return metadata dtype (#246)
houjun Apr 17, 2025
3bcd2d2
Region info transfer struct type and helper functions (#247)
TheAssembler1 Apr 21, 2025
34ab14f
Fix issues with PDC tools (#249)
houjun Apr 21, 2025
9026ed3
Fix printing in `PGOTO_ERROR` and `PGOTO_ERROR_VOID` (#250)
TheAssembler1 Apr 21, 2025
1653e4f
Group Tests Into Folders (#252)
TheAssembler1 May 12, 2025
90563dd
Return the same obj_id if the obj is just created or already opened (…
houjun May 13, 2025
c42b749
add option to choose interface (#255)
jeanbez May 15, 2025
91914b4
Fix multithreading compilation (#259)
TheAssembler1 May 20, 2025
54383bf
Fix segmentation fault of calling `PDCobj_create_mpi` twice with dupl…
TheAssembler1 May 20, 2025
ebac866
Use `PDC_malloc`, `PDC_free`, `PDC_calloc`, and `PDC_realloc` (#260)
TheAssembler1 May 22, 2025
c6b3ade
Fix Sphinx documentation errors and warnings (#265)
TheAssembler1 May 27, 2025
1106828
Replace `docs/README.md` -> steps to build docs (#268)
TheAssembler1 May 27, 2025
3549007
Use `FUNC_ENTER` and `FUNC_LEAVE` (#270)
TheAssembler1 Jun 3, 2025
5a5714a
New test macros and code cleanup (#261)
TheAssembler1 Jun 11, 2025
d1ef4fb
Tests logging typo fix (#273)
TheAssembler1 Jun 24, 2025
8deaa79
Rename pdc_server.exe to pdc_server for consistency (#275)
TheAssembler1 Jul 2, 2025
2c20971
Update vpicio_mts.c (#276)
TheAssembler1 Jul 2, 2025
7c118b2
Client Propogate `HG_Finalize` error on `PDCclose` (#263)
TheAssembler1 Jul 15, 2025
7a42e85
Standardize ID Lookup Null Checks and Error Handling (#281)
TheAssembler1 Jul 17, 2025
99f612d
Obj open fix (#279)
TheAssembler1 Jul 17, 2025
aabd25a
Fix multithread (#274)
TheAssembler1 Jul 19, 2025
797833d
Fix seg fault when mercury initialization fails (#283)
TheAssembler1 Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/dependencies-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

set -eu -o pipefail

export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=FALSE

brew install open-mpi automake
brew install open-mpi automake m4 libtool

# libfabric
wget https://github.com/ofiwg/libfabric/archive/refs/tags/v1.15.2.tar.gz
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/gitlab-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: GitLab

on:
push:
branches:
- develop

jobs:
sync-with-gitlab:
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup git
run: |
git config --global user.name "PDC BOT"
git config --global user.email "pdc@example.com"

- name: Update branch
run: |
git fetch origin develop
git remote add gitlab https://${{ secrets.GITLAB_TOKEN_NAME }}:${{ secrets.GITLAB_TOKEN }}@${{ secrets.GITLAB_URL }}
git checkout develop
git push -f gitlab -u develop
28 changes: 28 additions & 0 deletions .github/workflows/gitlab-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: GitLab

on:
push:
branches:
- stable

jobs:
sync-with-gitlab:
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup git
run: |
git config --global user.name "PDC BOT"
git config --global user.email "pdc@example.com"

- name: Update branch
run: |
git fetch stable
git remote add gitlab https://${{ secrets.GITLAB_TOKEN_NAME }}:${{ secrets.GITLAB_TOKEN }}@${{ secrets.GITLAB_URL }}
git checkout stable
git push -f gitlab -u stable
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
sudo sh -c 'echo "`ipconfig getifaddr en0` PDC" >> /etc/hosts'
sudo scutil --set HostName PDC
export HG_TRANSPORT="sockets"
ctest -L serial
ctest -L serial --output-on-failure
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:

- name: Test PDC
working-directory: build
run: ctest -L serial
run: ctest -L serial --output-on-failure
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-no-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:

- name: Test PDC
working-directory: build
run: ctest -L serial
run: ctest -L serial --output-on-failure
3 changes: 2 additions & 1 deletion docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ PDC object APIs
* pdc: PDC class ID, returned from PDCInit
* Output:
* Local object ID
* Open a PDC ID created previously by name.
* Open a PDC ID created previously by name, if an object is just created or already opened,
return the same obj_id. Each open requires a close.
* For developers: see pdc_obj.c. Need to communicate with servers for metadata of the object.

* perr_t PDCobj_close(pdcid_t obj_id)
Expand Down
59 changes: 19 additions & 40 deletions src/api/pdc_client_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "pdc_transforms_common.h"
#include "pdc_client_connect.h"
#include "pdc_logger.h"
#include "pdc_malloc.h"

#include "mercury.h"
#include "mercury_macros.h"
Expand Down Expand Up @@ -1354,7 +1355,7 @@ PDC_Client_mercury_init(hg_class_t **hg_class, hg_context_t **hg_context, int po
{
perr_t ret_value = SUCCEED;
char na_info_string[NA_STRING_INFO_LEN];
char hostname[HOSTNAME_LEN];
char * hostname;
int local_server_id;
/* Set the default mercury transport
* but enable overriding that to any of:
Expand All @@ -1378,14 +1379,19 @@ PDC_Client_mercury_init(hg_class_t **hg_class, hg_context_t **hg_context, int po
if ((hg_transport = getenv("HG_TRANSPORT")) == NULL) {
hg_transport = default_hg_transport;
}
memset(hostname, 0, sizeof(hostname));
gethostname(hostname, sizeof(hostname));
if ((hostname = getenv("HG_HOST")) == NULL) {
hostname = PDC_malloc(HOSTNAME_LEN);
memset(hostname, 0, HOSTNAME_LEN);
gethostname(hostname, HOSTNAME_LEN - 1);
}
sprintf(na_info_string, "%s://%s:%d", hg_transport, hostname, port);
if (pdc_client_mpi_rank_g == 0) {
LOG_INFO("==PDC_CLIENT: using %.7s\n", na_info_string);
LOG_INFO("==PDC_CLIENT: using %s\n", na_info_string);
fflush(stdout);
}

free(hostname);

// gni starts here
#ifdef PDC_HAS_CRAY_DRC
/* Acquire credential */
Expand Down Expand Up @@ -3047,30 +3053,10 @@ pack_region_metadata(int ndim, uint64_t *offset, uint64_t *size, region_info_tra

FUNC_ENTER(NULL);
transfer->ndim = ndim;
if (ndim >= 1) {
transfer->start_0 = offset[0];
transfer->count_0 = size[0];
}
else {
transfer->start_0 = 0;
transfer->count_0 = 0;
}
if (ndim >= 2) {
transfer->count_1 = size[1];
transfer->start_1 = offset[1];
}
else {
transfer->start_1 = 0;
transfer->count_1 = 0;
}
if (ndim >= 3) {
transfer->count_2 = size[2];
transfer->start_2 = offset[2];
}
else {
transfer->start_2 = 0;
transfer->count_2 = 0;
}

PDC_copy_region_desc(offset, transfer->start, ndim, ndim);
PDC_copy_region_desc(size, transfer->count, ndim, ndim);

fflush(stdout);
FUNC_LEAVE(ret_value);
}
Expand Down Expand Up @@ -3521,16 +3507,9 @@ PDC_Client_transfer_request(void *buf, pdcid_t obj_id, uint32_t data_server_id,
in.access_type = access_type;
in.remote_unit = unit;
in.obj_id = obj_id;
in.obj_ndim = obj_ndim;
if (in.obj_ndim >= 1) {
in.obj_dim0 = obj_dims[0];
}
if (in.obj_ndim >= 2) {
in.obj_dim1 = obj_dims[1];
}
if (in.obj_ndim >= 3) {
in.obj_dim2 = obj_dims[2];
}

in.obj_ndim = obj_ndim;
PDC_copy_region_desc(obj_dims, in.obj_dims, in.obj_ndim, in.obj_ndim);

// Compute metadata server id
meta_server_id = PDC_get_server_by_obj_id(obj_id, pdc_server_num_g);
Expand Down Expand Up @@ -6586,8 +6565,8 @@ PDC_Client_read_with_storage_meta(int nobj, region_storage_meta_t **all_storage_
prev_fname = fname;

// TODO: currently assumes 1d data and 1 storage region per object
storage_start = all_storage_meta[i]->region_transfer.start_0;
storage_count = all_storage_meta[i]->region_transfer.count_0;
storage_start = all_storage_meta[i]->region_transfer.start[0];
storage_count = all_storage_meta[i]->region_transfer.count[0];
req_start = storage_start;
req_count = storage_count;
file_offset = all_storage_meta[i]->offset;
Expand Down
20 changes: 20 additions & 0 deletions src/api/pdc_obj/pdc_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,29 @@ PDCobj_open_common(const char *obj_name, pdcid_t pdc, int is_col)
pdcid_t obj_prop;
size_t i;
uint32_t metadata_server_id;
obj_handle * oh;
struct pdc_obj_info * info;
int is_opened = 0;

FUNC_ENTER(NULL);

// Search if the object has already been opened
oh = PDCobj_iter_start(pdc);
while (!PDCobj_iter_null(oh)) {
info = PDCobj_iter_get_info(oh);
if (strcmp(obj_name, info->name) == 0) {
is_opened = 1;
break;
}
oh = PDCobj_iter_next(oh, pdc);
}

if (is_opened) {
ret_value = info->local_id;
PDC_inc_ref(info->local_id);
goto done;
}

p = (struct _pdc_obj_info *)PDC_malloc(sizeof(struct _pdc_obj_info));
if (!p)
PGOTO_ERROR(0, "PDC object memory allocation failed");
Expand Down
135 changes: 135 additions & 0 deletions src/api/pdc_region/include/pdc_region.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@

#include "pdc_public.h"
#include "pdc_obj.h"

#ifdef ENABLE_MPI
#include "mpi.h"
#endif

#define DIM_MAX 4

/**************************/
/* Library Public Struct */
/**************************/
Expand All @@ -46,6 +49,13 @@ struct pdc_region_info {
size_t unit;
};

// Similar structure PDC_region_info_t defined in pdc_obj_pkg.h
typedef struct region_info_transfer_t {
size_t ndim;
uint64_t start[DIM_MAX];
uint64_t count[DIM_MAX];
} region_info_transfer_t;

typedef enum {
PDC_TRANSFER_STATUS_COMPLETE = 0,
PDC_TRANSFER_STATUS_PENDING = 1,
Expand Down Expand Up @@ -253,4 +263,129 @@ perr_t PDCreg_obtain_lock(pdcid_t obj_id, pdcid_t reg_id, pdc_access_t access_ty
*/
perr_t PDCreg_release_lock(pdcid_t obj_id, pdcid_t reg_id, pdc_access_t access_type);

/**
* @brief Check if two region info transfers are identical.
*
* Compares two region info transfer structures (`reg1` and `reg2`) to determine if they
* are equal. The comparison checks if all bytes within the structures match.
*
* @param reg1 [IN] Pointer to the first region info transfer to compare.
* @param reg2 [IN] Pointer to the second region info transfer to compare.
*
* @return 1 if the region info transfers are identical, -1 otherwise.
*/
pbool_t PDC_region_info_transfer_t_is_equal(const region_info_transfer_t *reg1,
const region_info_transfer_t *reg2);

/**
* @brief Copy a region info transfer to another region.
*
* Copies the data from one region info transfer structure (`src_reg`) to another (`dest_reg`).
*
* @param src_reg [IN] Pointer to the source region info transfer to copy from.
* @param dest_reg [OUT] Pointer to the destination region info transfer to copy to.
*
* @return Non-negative on success, negative on failure.
*/
perr_t PDC_copy_region_info_transfer_t(const region_info_transfer_t *src_reg,
region_info_transfer_t * dest_reg);

/**
* @brief Calculate the size of a region descriptor in bytes.
*
* This function computes the size of the region described by `src_reg` in bytes by
* multiplying the size of each dimension by the element size (`unit`).
* The size in bytes is computed as the product of all dimensions, scaled by `unit`.
*
* @param src_reg [IN] Pointer to the source region descriptor (in elements)
* @param unit [IN] Size of each element in bytes
* @param ndim [IN] Number of dimensions in the region descriptor
*
* @return The size of the region in bytes.
*/
uint64_t PDC_get_region_desc_size_bytes(uint64_t *src_reg, int unit, int ndim);

/**
* @brief Calculate the size of a region descriptor in elements from region desccriptor in bytes.
*
* This function computes the size of the region described by `src_reg` in terms of the
* number of elements by dividing the given byte size by the element size (`unit`).
*
* @param src_reg [IN] Pointer to the source region descriptor (in bytes)
* @param unit [IN] Size of each element in bytes
* @param ndim [IN] Number of dimensions in the region descriptor
*
* @return The size of the region in terms of the number of elements.
*/
uint64_t PDC_get_region_desc_size_from_bytes_to_elements(const uint64_t *src_reg, int unit, int ndim);

/**
* @brief Calculate the total size of a region descriptor in elements.
*
* This function computes the total size of the region described by `src_reg`,
* by multiplying the dimensions of the region. The size is returned in terms
* of the number of elements, not bytes.
*
* @param src_reg [IN] Pointer to the source region descriptor (in elements)
* @param ndim [IN] Number of dimensions in the region descriptor
*
* @return The total size of the region in terms of the number of elements.
*/
uint64_t PDC_get_region_desc_size(const uint64_t *src_reg, int ndim);

/**
* @brief Convert a region descriptor from byte units to element units.
*
* Copies the region dimensions from the source descriptor to the destination descriptor,
* converting each dimension from bytes to elements by dividing by the element size.
* For each dimension i:
* dest_reg[i] = src_reg[i] / unit
*
* Both source and destination pointers must be non-null.
*
* @param src_reg [IN] Pointer to the source region descriptor (in bytes)
* @param dest_reg [OUT] Pointer to the destination region descriptor (in elements)
* @param unit [IN] Size of each element in bytes
* @param ndim [IN] Number of dimensions in the region
*
* @return Non-negative on success, negative on failure.
*/
perr_t PDC_copy_region_desc_bytes_to_elements(const uint64_t *src_reg, uint64_t *dest_reg, int unit,
int ndim);

/**
* @brief Copy a region descriptor from source to destination without unit scaling.
*
* Copies each dimension from the source region descriptor to the destination region
* descriptor without applying any scaling. The number of dimensions may differ between
* source and destination, in which case only the common number of dimensions is copied.
*
* Validates that both source and destination pointers are not NULL.
*
* @param src_reg [IN] Pointer to the source region descriptor
* @param dest_reg [OUT] Pointer to the destination region descriptor
* @param src_ndim [IN] Number of dimensions in the source region
* @param dest_ndim [IN] Number of dimensions in the destination region
*
* @return Non-negative on success, negative on failure.
*/
perr_t PDC_copy_region_desc(const uint64_t *src_reg, uint64_t *dest_reg, int src_ndim, int dest_ndim);

/**
* @brief Copy a region descriptor from element units to byte units.
*
* Sets each dimension of the destination region descriptor equal to the
* corresponding dimension of the source descriptor multiplied by the element size in bytes.
* For the i-th dimension: dest_reg[i] = src_reg[i] * unit
*
* @param src_reg [IN] Pointer to the source region descriptor (in elements)
* @param dest_reg [OUT] Pointer to the destination region descriptor (in bytes)
* @param unit [IN] Size of each element in bytes
* @param dest_ndim [IN] Number of dimensions in the destination region
*
* @return Non-negative on success, negative on failure.
*/
perr_t PDC_copy_region_desc_elements_to_bytes(const uint64_t *src_reg, uint64_t *dest_reg, int unit,
int dest_ndim);

#endif /* PDC_REGION_H */
1 change: 1 addition & 0 deletions src/commons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ install(
${PDC_SOURCE_DIR}/src/commons/utils/include/pdc_id_pkg.h
${PDC_SOURCE_DIR}/src/commons/utils/include/pdc_malloc.h
${PDC_SOURCE_DIR}/src/commons/utils/include/pdc_linkedlist.h
${PDC_SOURCE_DIR}/src/commons/logging/include/pdc_logger.h
DESTINATION
${PDC_INSTALL_INCLUDE_DIR}
COMPONENT
Expand Down
Loading
Loading