1414 * et Automatique. All rights reserved.
1515 * Copyright (c) 2011-2012 Los Alamos National Security, LLC.
1616 * Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
17- * Copyright (c) 2014-2016 Research Organization for Information Science
17+ * Copyright (c) 2014-2017 Research Organization for Information Science
1818 * and Technology (RIST). All rights reserved.
1919 * Copyright (c) 2016 IBM Corporation. All rights reserved.
2020 * $COPYRIGHT$
@@ -817,6 +817,10 @@ void orte_plm_base_daemon_topology(int status, orte_process_name_t* sender,
817817 int i ;
818818 uint32_t h ;
819819 orte_job_t * jdata ;
820+ uint8_t flag ;
821+ size_t inlen , cmplen ;
822+ uint8_t * packed_data , * cmpdata ;
823+ opal_buffer_t datbuf , * data ;
820824
821825 OPAL_OUTPUT_VERBOSE ((5 , orte_plm_base_framework .framework_output ,
822826 "%s plm:base:daemon_topology recvd for daemon %s" ,
@@ -832,10 +836,55 @@ void orte_plm_base_daemon_topology(int status, orte_process_name_t* sender,
832836 orted_failed_launch = true;
833837 goto CLEANUP ;
834838 }
839+ OBJ_CONSTRUCT (& datbuf , opal_buffer_t );
840+ /* unpack the flag to see if this payload is compressed */
841+ idx = 1 ;
842+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & flag , & idx , OPAL_INT8 ))) {
843+ ORTE_ERROR_LOG (rc );
844+ orted_failed_launch = true;
845+ goto CLEANUP ;
846+ }
847+ if (flag ) {
848+ /* unpack the data size */
849+ idx = 1 ;
850+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & inlen , & idx , OPAL_SIZE ))) {
851+ ORTE_ERROR_LOG (rc );
852+ orted_failed_launch = true;
853+ goto CLEANUP ;
854+ }
855+ /* unpack the unpacked data size */
856+ idx = 1 ;
857+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & cmplen , & idx , OPAL_SIZE ))) {
858+ ORTE_ERROR_LOG (rc );
859+ orted_failed_launch = true;
860+ goto CLEANUP ;
861+ }
862+ /* allocate the space */
863+ packed_data = (uint8_t * )malloc (inlen );
864+ /* unpack the data blob */
865+ idx = inlen ;
866+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , packed_data , & idx , OPAL_UINT8 ))) {
867+ ORTE_ERROR_LOG (rc );
868+ orted_failed_launch = true;
869+ goto CLEANUP ;
870+ }
871+ /* decompress the data */
872+ if (orte_util_uncompress_block (& cmpdata , cmplen ,
873+ packed_data , inlen )) {
874+ /* the data has been uncompressed */
875+ opal_dss .load (& datbuf , cmpdata , cmplen );
876+ data = & datbuf ;
877+ } else {
878+ data = buffer ;
879+ }
880+ free (packed_data );
881+ } else {
882+ data = buffer ;
883+ }
835884
836885 /* unpack the topology signature for this node */
837886 idx = 1 ;
838- if (OPAL_SUCCESS != (rc = opal_dss .unpack (buffer , & sig , & idx , OPAL_STRING ))) {
887+ if (OPAL_SUCCESS != (rc = opal_dss .unpack (data , & sig , & idx , OPAL_STRING ))) {
839888 ORTE_ERROR_LOG (rc );
840889 orted_failed_launch = true;
841890 goto CLEANUP ;
@@ -861,7 +910,7 @@ void orte_plm_base_daemon_topology(int status, orte_process_name_t* sender,
861910
862911 /* unpack the topology */
863912 idx = 1 ;
864- if (OPAL_SUCCESS != (rc = opal_dss .unpack (buffer , & topo , & idx , OPAL_HWLOC_TOPO ))) {
913+ if (OPAL_SUCCESS != (rc = opal_dss .unpack (data , & topo , & idx , OPAL_HWLOC_TOPO ))) {
865914 ORTE_ERROR_LOG (rc );
866915 orted_failed_launch = true;
867916 goto CLEANUP ;
@@ -873,7 +922,7 @@ void orte_plm_base_daemon_topology(int status, orte_process_name_t* sender,
873922
874923 /* unpack any coprocessors */
875924 idx = 1 ;
876- if (OPAL_SUCCESS != (rc = opal_dss .unpack (buffer , & coprocessors , & idx , OPAL_STRING ))) {
925+ if (OPAL_SUCCESS != (rc = opal_dss .unpack (data , & coprocessors , & idx , OPAL_STRING ))) {
877926 ORTE_ERROR_LOG (rc );
878927 orted_failed_launch = true;
879928 goto CLEANUP ;
@@ -900,7 +949,7 @@ void orte_plm_base_daemon_topology(int status, orte_process_name_t* sender,
900949 }
901950 /* see if this daemon is on a coprocessor */
902951 idx = 1 ;
903- if (OPAL_SUCCESS != (rc = opal_dss .unpack (buffer , & coprocessors , & idx , OPAL_STRING ))) {
952+ if (OPAL_SUCCESS != (rc = opal_dss .unpack (data , & coprocessors , & idx , OPAL_STRING ))) {
904953 ORTE_ERROR_LOG (rc );
905954 orted_failed_launch = true;
906955 goto CLEANUP ;
@@ -1088,8 +1137,57 @@ void orte_plm_base_daemon_callback(int status, orte_process_name_t* sender,
10881137 /* rank=1 always sends its topology back */
10891138 topo = NULL ;
10901139 if (1 == dname .vpid ) {
1140+ uint8_t flag ;
1141+ size_t inlen , cmplen ;
1142+ uint8_t * packed_data , * cmpdata ;
1143+ opal_buffer_t datbuf , * data ;
1144+ OBJ_CONSTRUCT (& datbuf , opal_buffer_t );
1145+ /* unpack the flag to see if this payload is compressed */
1146+ idx = 1 ;
1147+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & flag , & idx , OPAL_INT8 ))) {
1148+ ORTE_ERROR_LOG (rc );
1149+ orted_failed_launch = true;
1150+ goto CLEANUP ;
1151+ }
1152+ if (flag ) {
1153+ /* unpack the data size */
1154+ idx = 1 ;
1155+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & inlen , & idx , OPAL_SIZE ))) {
1156+ ORTE_ERROR_LOG (rc );
1157+ orted_failed_launch = true;
1158+ goto CLEANUP ;
1159+ }
1160+ /* unpack the unpacked data size */
1161+ idx = 1 ;
1162+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , & cmplen , & idx , OPAL_SIZE ))) {
1163+ ORTE_ERROR_LOG (rc );
1164+ orted_failed_launch = true;
1165+ goto CLEANUP ;
1166+ }
1167+ /* allocate the space */
1168+ packed_data = (uint8_t * )malloc (inlen );
1169+ /* unpack the data blob */
1170+ idx = inlen ;
1171+ if (ORTE_SUCCESS != (rc = opal_dss .unpack (buffer , packed_data , & idx , OPAL_UINT8 ))) {
1172+ ORTE_ERROR_LOG (rc );
1173+ orted_failed_launch = true;
1174+ goto CLEANUP ;
1175+ }
1176+ /* decompress the data */
1177+ if (orte_util_uncompress_block (& cmpdata , cmplen ,
1178+ packed_data , inlen )) {
1179+ /* the data has been uncompressed */
1180+ opal_dss .load (& datbuf , cmpdata , cmplen );
1181+ data = & datbuf ;
1182+ } else {
1183+ data = buffer ;
1184+ }
1185+ free (packed_data );
1186+ } else {
1187+ data = buffer ;
1188+ }
10911189 idx = 1 ;
1092- if (OPAL_SUCCESS != (rc = opal_dss .unpack (buffer , & topo , & idx , OPAL_HWLOC_TOPO ))) {
1190+ if (OPAL_SUCCESS != (rc = opal_dss .unpack (data , & topo , & idx , OPAL_HWLOC_TOPO ))) {
10931191 ORTE_ERROR_LOG (rc );
10941192 orted_failed_launch = true;
10951193 goto CLEANUP ;
0 commit comments