-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Info API #443
Draft
abouteiller
wants to merge
2
commits into
ICLDisco:master
Choose a base branch
from
abouteiller:feature/info
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Info API #443
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "parsec_config.h" | ||
#include "parsec.h" | ||
#include "parsec/utils/info.h" | ||
#include "parsec/class/hashtable.h" | ||
#include "parsec/class/parsec_object.h" | ||
|
||
PARSEC_OBJ_CLASS_INSTANCE(parsec_info_t, parsec_hashtable_t, NULL, NULL); | ||
|
||
int parsec_info_set(parsec_info_t *info, const char *key, char *value) { | ||
return PARSEC_NOT_IMPLEMENTED; | ||
} | ||
|
||
int parsec_info_get(parsec_info_t *info, const char *key, char **value) { | ||
return PARSEC_NOT_IMPLEMENTED; | ||
} | ||
|
||
int parsec_info_clear(parsec_info_t *info) { | ||
/* must clear in-place as multiple refs ot the info may be held */ | ||
return PARSEC_NOT_IMPLEMENTED; | ||
} | ||
|
||
int parsec_context_get_info(parsec_context_t *ctx, parsec_info_t **info) { | ||
if(NULL == ctx->info) { | ||
ctx->info = PARSEC_OBJ_NEW(parsec_info_t); | ||
} | ||
return ctx->info; | ||
} | ||
|
||
int parsec_taskpool_get_info(parsec_taskpool_t *tp, parsec_info_t **info) { | ||
if(NULL == tp->info) { | ||
tp->info = PARSEC_OBJ_NEW(parsec_info_t); | ||
} | ||
return tp->info; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
/* | ||
* Copyright (c) 2022 The University of Tennessee and The University | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
*/ | ||
|
||
/** | ||
* @file | ||
* | ||
* Generic routines for "info" handling. This is a sinple key-value store that | ||
* is independent from the main MCA param key-value store. Helpful for creating | ||
* info strings without affecting MCA params. | ||
*/ | ||
|
||
#ifndef PARSEC_INFO_H | ||
#define PARSEC_INFO_H | ||
|
||
#include "parsec/parsec_config.h" | ||
|
||
#ifdef PARSEC_HAVE_SYS_TYPES_H | ||
#include <sys/types.h> | ||
#endif | ||
#ifdef PARSEC_HAVE_STDBOOL_H | ||
#include <stdbool.h> | ||
#endif | ||
|
||
BEGIN_C_DECLS | ||
|
||
|
||
typedef char* parsec_info_key_t; | ||
typedef char* parsec_info_value_t; | ||
|
||
|
||
struct parsec_info_value_s { | ||
char val[PARSEC_INFO_VALUE_LEN]; | ||
} parsec_info_value_t; | ||
|
||
|
||
struct parsec_info_s { | ||
parsec_hashtable_t super; | ||
} parsec_info_t; | ||
|
||
PARSEC_OBJ_CLASS(parsec_info_t); | ||
|
||
} parsec_info_t; | ||
|
||
#define PARSEC_INFO_VALUE_NULL NULL | ||
|
||
|
||
/** | ||
* Set the key-value pair in the target info object. | ||
* | ||
* @param info Pointer to the target info object. Must not be | ||
* NULL. | ||
* @param key String for the key, max length PARSEC_INFO_KEY_LEN. | ||
* @param value String for the value to attache to the key, max | ||
* length PARSEC_INFO_VALUE_LEN. | ||
* | ||
* @retval PARSEC_SUCCESS On success | ||
* @retval PARSEC_ERROR On failure, values lower than PARSEC_ERROR may | ||
* elaborate on the particular error type. | ||
* | ||
* This function associates a string value to the string key in the | ||
* key-value store info. The value string is copied to the internal | ||
* storage of the key-value store. To reiterate, there is no need to | ||
* keep a copy of the value. | ||
* | ||
* If the key is already set to a value, the previous value is | ||
* overwritten for te key. In particular, if the value is | ||
* PARSEC_INFO_VALUE_NULL, the previous key-value pair is removed | ||
* from the info. | ||
*/ | ||
parsec_info_set(parsec_info_t *info, const char *key, const char *value); | ||
|
||
/** | ||
* Get the value associated with the key in the target info object. | ||
* | ||
* @param info Pointer to the target info object. Must not be | ||
* NULL. | ||
* @param key String for the key, max length PARSEC_INFO_KEY_LEN. | ||
* @param value Pointer to the string of the value to retrieve; | ||
* | ||
* @retval PARSEC_SUCCESS On success | ||
* @retval PARSEC_ERROR On failure, values lower than PARSEC_ERROR may | ||
* elaborate on the particular error type. | ||
* | ||
* This function obtains the string value associated with the string | ||
* key in the key-value store info. A pointer to the internal value | ||
* string is returned. To reiterate, the value is shared with the | ||
* internal storage of the info object and must not be freed. | ||
* | ||
* If the key is not set to a value, the value is set to | ||
* PARSEC_INFO_VALUE_NULL. | ||
*/ | ||
parsec_info_get(parsec_info_t *info, const char *key, char **value); | ||
|
||
/** | ||
* Clear all key-values from the target info object. | ||
* | ||
* @param info Pointer to the target info object. Must not be | ||
* NULL. | ||
* | ||
* @retval PARSEC_SUCCESS On success | ||
* @retcal PARSEC_ERROR On failure, values lower than PARSEC_ERROR may | ||
* elaborate on the particular error type. | ||
* | ||
* This function clears all previously set key-values from the target | ||
* key-value store object; that is, it is equivalent to calling | ||
* parsec_info_set with the value PARSEC_INFO_VALUE_NULL, for any key | ||
* previously set on the info. | ||
*/ | ||
parsec_info_clear(parserc_info_t *info); | ||
|
||
/** | ||
* Obtain the info object associated with the givent context | ||
* | ||
* @param ctx The context to query | ||
* @param info Pointer to the info object associated with the context | ||
* | ||
* @retval PARSEC_SUCCESS On success | ||
* @retval PARSEC_ERROR On failure | ||
* | ||
* The returned info object may be empty (that is, it has no values | ||
* associated with any keys), but is always returns a reference to a | ||
* valid info object. | ||
* | ||
* Key-values added, modified, or removed to/from the info object will | ||
* be implicitly applied to the context, that is, behavior for calls | ||
* using that context may be altered accordingly to the set key-values. | ||
* | ||
* The returned info is a reference to the info object internally held | ||
* by the context. The Info object should never be freed, and it ceases | ||
* to be a valid reference when the concext has been freed. | ||
*/ | ||
parsec_context_get_info(parsec_context_t *ctx, parsec_info_t **info); | ||
|
||
/** | ||
* Obtain the info object associated with the givent taskpool | ||
* | ||
* @param tp The taskpool to query | ||
* @param info Pointer to the info object associated with the context | ||
* | ||
* @retval PARSEC_SUCCESS On success | ||
* @retval PARSEC_ERROR On failure | ||
* | ||
* The returned info object may be empty (that is, it has no values | ||
* associated with any keys), but is always returns a reference to a | ||
* valid info object. | ||
* | ||
* Key-values added, modified, or removed to/from the info object will | ||
* be implicitly applied to the taskpool, that is, behavior for calls | ||
* using that taskpool may be altered accordingly to the set key-values. | ||
* | ||
* The returned info is a reference to the info object internally held | ||
* by the taskpool. The Info object should never be freed, and it ceases | ||
* to be a valid reference when the taskpool has been freed. | ||
*/ | ||
parsec_taskpool_get_info(parsec_taskpool_t *tp, parsec_info_t **info); | ||
|
||
END_C_DECLS | ||
|
||
#endif /* PARSEC_INFO_H */ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo.