2005-03-14 23:57:21 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 07:32:36 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2014-04-30 01:49:23 +04:00
|
|
|
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2008-02-28 04:57:57 +03:00
|
|
|
* DSS Buffer Operations
|
2005-03-14 23:57:21 +03:00
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal_config.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
#include "opal/util/error.h"
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "opal/dss/dss_internal.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
int opal_dss_unload(opal_buffer_t *buffer, void **payload,
|
|
|
|
int32_t *bytes_used)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
|
|
|
/* check that buffer is not null */
|
|
|
|
if (!buffer) {
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* were we given someplace to point to the payload */
|
|
|
|
if (NULL == payload) {
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* anything in the buffer - if not, nothing to do */
|
2005-05-01 04:53:00 +04:00
|
|
|
if (NULL == buffer->base_ptr || 0 == buffer->bytes_used) {
|
2005-03-14 23:57:21 +03:00
|
|
|
*payload = NULL;
|
2005-05-01 04:53:00 +04:00
|
|
|
*bytes_used = 0;
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
2006-12-07 02:19:06 +03:00
|
|
|
|
2005-05-01 04:53:00 +04:00
|
|
|
/* okay, we have something to provide - pass it back */
|
2005-03-14 23:57:21 +03:00
|
|
|
*payload = buffer->base_ptr;
|
2007-05-23 18:06:32 +04:00
|
|
|
*bytes_used = buffer->bytes_used;
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* dereference everything in buffer */
|
|
|
|
buffer->base_ptr = NULL;
|
2005-05-01 04:53:00 +04:00
|
|
|
buffer->pack_ptr = buffer->unpack_ptr = NULL;
|
2007-04-06 23:40:29 +04:00
|
|
|
buffer->bytes_allocated = buffer->bytes_used = 0;
|
2005-05-01 04:53:00 +04:00
|
|
|
|
|
|
|
/* All done */
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
int opal_dss_load(opal_buffer_t *buffer, void *payload,
|
|
|
|
int32_t bytes_used)
|
2005-03-14 23:57:21 +03:00
|
|
|
{
|
|
|
|
/* check to see if the buffer has been initialized */
|
|
|
|
if (NULL == buffer) {
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* check if buffer already has payload - free it if so */
|
|
|
|
if (NULL != buffer->base_ptr) {
|
|
|
|
free(buffer->base_ptr);
|
|
|
|
}
|
2006-12-07 02:19:06 +03:00
|
|
|
|
2014-08-29 21:24:55 +04:00
|
|
|
/* if it's a NULL payload, just set things and return */
|
|
|
|
if (NULL == payload) {
|
|
|
|
buffer->base_ptr = NULL;
|
|
|
|
buffer->pack_ptr = buffer->base_ptr;
|
|
|
|
buffer->unpack_ptr = buffer->base_ptr;
|
|
|
|
buffer->bytes_used = 0;
|
|
|
|
buffer->bytes_allocated = 0;
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/* populate the buffer */
|
2006-08-23 07:32:36 +04:00
|
|
|
buffer->base_ptr = (char*)payload;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-05-01 04:53:00 +04:00
|
|
|
/* set pack/unpack pointers */
|
|
|
|
buffer->pack_ptr = ((char*)buffer->base_ptr) + bytes_used;
|
|
|
|
buffer->unpack_ptr = buffer->base_ptr;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-05-01 04:53:00 +04:00
|
|
|
/* set counts for size and space */
|
|
|
|
buffer->bytes_allocated = buffer->bytes_used = bytes_used;
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-05-01 04:53:00 +04:00
|
|
|
/* All done */
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
2005-03-14 23:57:21 +03:00
|
|
|
}
|
|
|
|
|
2007-05-23 18:06:32 +04:00
|
|
|
|
|
|
|
/* Copy the UNPACKED portion of a source buffer into a destination buffer
|
|
|
|
* The complete contents of the src buffer are NOT copied - only that
|
|
|
|
* portion that has not been previously unpacked is copied.
|
|
|
|
*/
|
2008-02-28 04:57:57 +03:00
|
|
|
int opal_dss_copy_payload(opal_buffer_t *dest, opal_buffer_t *src)
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
{
|
|
|
|
char *dst_ptr;
|
2008-02-28 04:57:57 +03:00
|
|
|
int32_t bytes_left;
|
2007-05-23 18:06:32 +04:00
|
|
|
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
/* ensure we have valid source and destination */
|
|
|
|
if (NULL == dest || NULL == src) {
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_ERR_BAD_PARAM;
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* if the dest is already populated, check to ensure that both
|
|
|
|
* source and dest are of the same buffer type
|
|
|
|
*/
|
|
|
|
if (0 != dest->bytes_used) {
|
|
|
|
if (dest->type != src->type) {
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_ERR_BUFFER;
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* either the dest was empty or the two types already match -
|
|
|
|
* either way, just ensure the two types DO match
|
|
|
|
*/
|
|
|
|
dest->type = src->type;
|
|
|
|
|
2007-05-23 18:06:32 +04:00
|
|
|
/* compute how much of the src buffer remains unpacked
|
|
|
|
* buffer->bytes_used is the total number of bytes in the buffer that
|
|
|
|
* have been packed. However, we may have already unpacked some of
|
|
|
|
* that data. We only want to unload what remains unpacked. This
|
|
|
|
* means we have to look at how much of the buffer remains "used"
|
|
|
|
* beyond the unpack_ptr
|
|
|
|
*/
|
|
|
|
bytes_left = src->bytes_used - (src->unpack_ptr - src->base_ptr);
|
|
|
|
|
|
|
|
/* if nothing is left, then nothing to do */
|
|
|
|
if (0 == bytes_left) {
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
2007-05-23 18:06:32 +04:00
|
|
|
}
|
|
|
|
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
/* add room to the dest for the src buffer's payload */
|
2008-02-28 04:57:57 +03:00
|
|
|
if (NULL == (dst_ptr = opal_dss_buffer_extend(dest, bytes_left))) {
|
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* copy the src payload to the specified location in dest */
|
2007-05-23 18:06:32 +04:00
|
|
|
memcpy(dst_ptr, src->unpack_ptr, bytes_left);
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
|
|
|
|
/* adjust the dest buffer's bookkeeping */
|
2007-05-23 18:06:32 +04:00
|
|
|
dest->bytes_used += bytes_left;
|
|
|
|
dest->pack_ptr = ((char*)dest->pack_ptr) + bytes_left;
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
|
2008-02-28 04:57:57 +03:00
|
|
|
return OPAL_SUCCESS;
|
Commit the orted-failed-to-start code. This correctly causes the system to detect the failure of an orted to start and allows the system to terminate all procs/orteds that *did* start.
The primary change that underlies all this is in the OOB. Specifically, the problem in the code until now has been that the OOB attempts to resolve an address when we call the "send" to an unknown recipient. The OOB would then wait forever if that recipient never actually started (and hence, never reported back its OOB contact info). In the case of an orted that failed to start, we would correctly detect that the orted hadn't started, but then we would attempt to order all orteds (including the one that failed to start) to die. This would cause the OOB to "hang" the system.
Unfortunately, revising how the OOB resolves addresses introduced a number of additional problems. Specifically, and most troublesome, was the fact that comm_spawn involved the immediate transmission of the rendezvous point from parent-to-child after the child was spawned. The current code used the OOB address resolution as a "barrier" - basically, the parent would attempt to send the info to the child, and then "hold" there until the child's contact info had arrived (meaning the child had started) and the send could be completed.
Note that this also caused comm_spawn to "hang" the entire system if the child never started... The app-failed-to-start helped improve that behavior - this code provides additional relief.
With this change, the OOB will return an ADDRESSEE_UNKNOWN error if you attempt to send to a recipient whose contact info isn't already in the OOB's hash tables. To resolve comm_spawn issues, we also now force the cross-sharing of connection info between parent and child jobs during spawn.
Finally, to aid in setting triggers to the right values, we introduce the "arith" API for the GPR. This function allows you to atomically change the value in a registry location (either divide, multiply, add, or subtract) by the provided operand. It is equivalent to first fetching the value using a "get", then modifying it, and then putting the result back into the registry via a "put".
This commit was SVN r14711.
2007-05-21 22:31:28 +04:00
|
|
|
}
|
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
int opal_value_load(opal_value_t *kv,
|
|
|
|
void *data, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
opal_byte_object_t *boptr;
|
2014-06-01 20:14:10 +04:00
|
|
|
struct timeval *tv;
|
|
|
|
|
|
|
|
kv->type = type;
|
|
|
|
if (NULL == data && OPAL_STRING != type && OPAL_BYTE_OBJECT != type) {
|
|
|
|
/* just set the fields to zero */
|
|
|
|
memset(&kv->data, 0, sizeof(kv->data));
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
2014-04-30 01:49:23 +04:00
|
|
|
|
|
|
|
switch (type) {
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_BOOL:
|
|
|
|
kv->data.flag = *(bool*)(data);
|
|
|
|
break;
|
|
|
|
case OPAL_BYTE:
|
|
|
|
kv->data.byte = *(uint8_t*)(data);
|
|
|
|
break;
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_STRING:
|
2014-06-01 20:14:10 +04:00
|
|
|
if (NULL != kv->data.string) {
|
|
|
|
free(kv->data.string);
|
|
|
|
}
|
2014-04-30 01:49:23 +04:00
|
|
|
if (NULL != data) {
|
|
|
|
kv->data.string = strdup( (const char *) data);
|
|
|
|
} else {
|
|
|
|
kv->data.string = NULL;
|
|
|
|
}
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_SIZE:
|
|
|
|
kv->data.size = *(size_t*)(data);
|
2014-04-30 01:49:23 +04:00
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_PID:
|
|
|
|
kv->data.pid = *(pid_t*)(data);
|
2014-04-30 01:49:23 +04:00
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_INT:
|
|
|
|
kv->data.integer = *(int*)(data);
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_INT8:
|
|
|
|
kv->data.int8 = *(int8_t*)(data);
|
|
|
|
break;
|
|
|
|
case OPAL_INT16:
|
|
|
|
kv->data.int16 = *(int16_t*)(data);
|
|
|
|
break;
|
|
|
|
case OPAL_INT32:
|
|
|
|
kv->data.int32 = *(int32_t*)(data);
|
|
|
|
break;
|
|
|
|
case OPAL_INT64:
|
|
|
|
kv->data.int64 = *(int64_t*)(data);
|
|
|
|
break;
|
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_UINT:
|
|
|
|
kv->data.uint = *(unsigned int*)(data);
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_UINT8:
|
|
|
|
kv->data.uint8 = *(uint8_t*)(data);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT16:
|
|
|
|
kv->data.uint16 = *(uint16_t*)(data);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT32:
|
|
|
|
kv->data.uint32 = *(uint32_t*)data;
|
|
|
|
break;
|
|
|
|
case OPAL_UINT64:
|
|
|
|
kv->data.uint64 = *(uint64_t*)(data);
|
2014-04-30 01:49:23 +04:00
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_BYTE_OBJECT:
|
2014-06-01 20:14:10 +04:00
|
|
|
if (NULL != kv->data.bo.bytes) {
|
|
|
|
free(kv->data.bo.bytes);
|
|
|
|
}
|
2014-04-30 01:49:23 +04:00
|
|
|
boptr = (opal_byte_object_t*)data;
|
|
|
|
if (NULL != boptr && NULL != boptr->bytes && 0 < boptr->size) {
|
|
|
|
kv->data.bo.bytes = (uint8_t *) malloc(boptr->size);
|
|
|
|
memcpy(kv->data.bo.bytes, boptr->bytes, boptr->size);
|
|
|
|
kv->data.bo.size = boptr->size;
|
|
|
|
} else {
|
|
|
|
kv->data.bo.bytes = NULL;
|
|
|
|
kv->data.bo.size = 0;
|
|
|
|
}
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
|
|
|
|
case OPAL_FLOAT:
|
|
|
|
kv->data.fval = *(float*)(data);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPAL_TIMEVAL:
|
|
|
|
tv = (struct timeval*)data;
|
|
|
|
kv->data.tv.tv_sec = tv->tv_sec;
|
|
|
|
kv->data.tv.tv_usec = tv->tv_usec;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPAL_PTR:
|
|
|
|
kv->data.ptr = data;
|
|
|
|
break;
|
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
default:
|
|
|
|
OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED);
|
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int opal_value_unload(opal_value_t *kv,
|
|
|
|
void **data, opal_data_type_t type)
|
|
|
|
{
|
|
|
|
opal_byte_object_t *boptr;
|
|
|
|
|
2014-06-01 20:14:10 +04:00
|
|
|
if (type != kv->type) {
|
|
|
|
return OPAL_ERR_TYPE_MISMATCH;
|
|
|
|
}
|
|
|
|
if (NULL == data && OPAL_STRING != type && OPAL_BYTE_OBJECT != type) {
|
|
|
|
OPAL_ERROR_LOG(OPAL_ERR_BAD_PARAM);
|
|
|
|
return OPAL_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
switch (type) {
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_BOOL:
|
|
|
|
memcpy(*data, &kv->data.flag, sizeof(bool));
|
|
|
|
break;
|
|
|
|
case OPAL_BYTE:
|
|
|
|
memcpy(*data, &kv->data.byte, sizeof(uint8_t));
|
|
|
|
break;
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_STRING:
|
|
|
|
if (NULL != kv->data.string) {
|
|
|
|
*data = strdup(kv->data.string);
|
|
|
|
} else {
|
|
|
|
*data = NULL;
|
|
|
|
}
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_SIZE:
|
|
|
|
memcpy(*data, &kv->data.size, sizeof(size_t));
|
2014-04-30 01:49:23 +04:00
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_PID:
|
|
|
|
memcpy(*data, &kv->data.pid, sizeof(pid_t));
|
2014-04-30 01:49:23 +04:00
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_INT:
|
|
|
|
memcpy(*data, &kv->data.integer, sizeof(int));
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_INT8:
|
|
|
|
memcpy(*data, &kv->data.int8, sizeof(int8_t));
|
|
|
|
break;
|
|
|
|
case OPAL_INT16:
|
|
|
|
memcpy(*data, &kv->data.int16, sizeof(int16_t));
|
|
|
|
break;
|
|
|
|
case OPAL_INT32:
|
|
|
|
memcpy(*data, &kv->data.int32, sizeof(int32_t));
|
|
|
|
break;
|
|
|
|
case OPAL_INT64:
|
|
|
|
memcpy(*data, &kv->data.int64, sizeof(int64_t));
|
|
|
|
break;
|
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_UINT:
|
|
|
|
memcpy(*data, &kv->data.uint, sizeof(unsigned int));
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
case OPAL_UINT8:
|
|
|
|
memcpy(*data, &kv->data.uint8, 1);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT16:
|
|
|
|
memcpy(*data, &kv->data.uint16, 2);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT32:
|
|
|
|
memcpy(*data, &kv->data.uint32, 4);
|
|
|
|
break;
|
|
|
|
case OPAL_UINT64:
|
|
|
|
memcpy(*data, &kv->data.uint64, 8);
|
2014-04-30 01:49:23 +04:00
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
case OPAL_BYTE_OBJECT:
|
|
|
|
boptr = (opal_byte_object_t*)malloc(sizeof(opal_byte_object_t));
|
|
|
|
if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) {
|
|
|
|
boptr->bytes = (uint8_t *) malloc(kv->data.bo.size);
|
|
|
|
memcpy(boptr->bytes, kv->data.bo.bytes, kv->data.bo.size);
|
|
|
|
boptr->size = kv->data.bo.size;
|
|
|
|
} else {
|
|
|
|
boptr->bytes = NULL;
|
|
|
|
boptr->size = 0;
|
|
|
|
}
|
|
|
|
*data = boptr;
|
|
|
|
break;
|
2014-06-01 20:14:10 +04:00
|
|
|
|
|
|
|
case OPAL_FLOAT:
|
|
|
|
memcpy(*data, &kv->data.fval, sizeof(float));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPAL_TIMEVAL:
|
|
|
|
memcpy(*data, &kv->data.tv, sizeof(struct timeval));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPAL_PTR:
|
|
|
|
*data = kv->data.ptr;
|
|
|
|
break;
|
|
|
|
|
2014-04-30 01:49:23 +04:00
|
|
|
default:
|
|
|
|
OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED);
|
|
|
|
return OPAL_ERR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|