35
35
/* ___INFO__MARK_END__*/
36
36
37
37
#include " uti/sge_binding_hlp.h"
38
+ #include " uti/sge_log.h"
39
+ #include " uti/sge_rmon_macros.h"
38
40
39
41
#if defined(BINDING_SOLARIS)
40
42
# include < sys/processor.h>
@@ -1270,10 +1272,12 @@ static bool account_job_on_topology(char** topology, const int topology_length,
1270
1272
* SEE ALSO
1271
1273
* ???/???
1272
1274
*******************************************************************************/
1273
- bool binding_explicit_check_and_account (const int * list_of_sockets, const int samount,
1274
- const int * list_of_cores, const int score, char ** topo_used_by_job,
1275
- int * topo_used_by_job_length)
1275
+ bool
1276
+ binding_explicit_check_and_account (const int * list_of_sockets, const int samount,
1277
+ const int * list_of_cores, const int score,
1278
+ char ** topo_used_by_job, int * topo_used_by_job_length)
1276
1279
{
1280
+ DENTER (TOP_LAYER);
1277
1281
int i;
1278
1282
1279
1283
/* position of <socket>,<core> in topology string */
@@ -1282,8 +1286,7 @@ bool binding_explicit_check_and_account(const int* list_of_sockets, const int sa
1282
1286
bool possible = true ;
1283
1287
1284
1288
/* input parameter validation */
1285
- if (samount != score || samount <= 0 || list_of_sockets == nullptr
1286
- || list_of_cores == nullptr ) {
1289
+ if (samount != score || samount <= 0 || list_of_sockets == nullptr || list_of_cores == nullptr ) {
1287
1290
return false ;
1288
1291
}
1289
1292
@@ -1295,28 +1298,39 @@ bool binding_explicit_check_and_account(const int* list_of_sockets, const int sa
1295
1298
return false ;
1296
1299
}
1297
1300
}
1301
+
1302
+ DPRINTF (" binding_explicit_check_and_account: logical_used_topology=%s; %d\n " , logical_used_topology, logical_used_topology_length);
1298
1303
1299
1304
/* create output string */
1300
1305
get_execd_topology (topo_used_by_job, topo_used_by_job_length);
1301
1306
1307
+ DPRINTF (" binding_explicit_check_and_account: topo_used_by_job=%s; %d\n " , *topo_used_by_job, *topo_used_by_job_length);
1308
+
1302
1309
/* go through the <socket>,<core> pair list */
1303
1310
for (i = 0 ; i < samount; i++) {
1304
1311
1312
+ DPRINTF (" binding_explicit_check_and_account: checking socket %d, core %d\n " , list_of_sockets[i], list_of_cores[i]);
1313
+
1305
1314
/* get position in topology string */
1306
- if ((pos = get_position_in_topology (list_of_sockets[i], list_of_cores[i],
1307
- logical_used_topology, logical_used_topology_length)) < 0 ) {
1308
- /* the <socket>,<core> does not exist */
1309
- possible = false ;
1310
- break ;
1311
- }
1315
+ if ((pos = get_position_in_topology (list_of_sockets[i], list_of_cores[i],
1316
+ logical_used_topology, logical_used_topology_length)) < 0 ) {
1317
+ /* the <socket>,<core> does not exist */
1318
+ DPRINTF (" binding_explicit_check_and_account: position in logical_used_topology not found for socket %d, core %d\n " , list_of_sockets[i], list_of_cores[i]);
1319
+ possible = false ;
1320
+ break ;
1321
+ }
1322
+
1323
+ DPRINTF (" binding_explicit_check_and_account: position in logical_used_topology string is %d\n " , pos);
1312
1324
1313
1325
/* check if this core is available (DG TODO introduce threads) */
1314
1326
if (logical_used_topology[pos] == ' C' ) {
1315
1327
/* do temporarily account it */
1316
1328
(*topo_used_by_job)[pos] = ' c' ;
1317
1329
/* thread binding: account threads here */
1318
1330
account_all_threads_after_core (topo_used_by_job, pos);
1331
+ DPRINTF (" topo_used_by_job after accounting found core at pos %d: %s\n " , pos, *topo_used_by_job);
1319
1332
} else {
1333
+ DPRINTF (" binding_explicit_check_and_account: core at position %d is not available\n " , pos);
1320
1334
/* core not usable -> early abort */
1321
1335
possible = false ;
1322
1336
break ;
@@ -1327,10 +1341,13 @@ bool binding_explicit_check_and_account(const int* list_of_sockets, const int sa
1327
1341
if (possible) {
1328
1342
if (!account_job_on_topology (&logical_used_topology, logical_used_topology_length,
1329
1343
*topo_used_by_job, *topo_used_by_job_length)) {
1344
+ DPRINTF (" binding_explicit_check_and_account: accounting on logical_used_topology failed\n " );
1330
1345
possible = false ;
1331
1346
}
1332
1347
}
1333
1348
1349
+ DPRINTF (" binding_explicit_check_and_account: logical_used_topology after accounting: %s\n " , logical_used_topology);
1350
+
1334
1351
/* free memory when unsuccessful */
1335
1352
if (!possible) {
1336
1353
sge_free (topo_used_by_job);
@@ -3266,16 +3283,16 @@ static int get_position_in_topology(const int socket, const int core,
3266
3283
}
3267
3284
3268
3285
for (i = 0 ; i < topology_length && topology[i] != ' \0 ' ; i++) {
3269
- if (topology[i] == ' S' ) {
3286
+ if (topology[i] == ' S' || topology[i] == ' s ' ) {
3270
3287
/* we've got a new socket */
3271
3288
s++;
3272
3289
/* invalidate core counter */
3273
3290
c = -1 ;
3274
- } else if (topology[i] == ' C' ) {
3291
+ } else if (topology[i] == ' C' || topology[i] == ' c ' ) {
3275
3292
/* we've got a new core */
3276
3293
c++;
3277
3294
/* invalidate thread counter */
3278
- } else if (topology[i] == ' T' ) {
3295
+ } else if (topology[i] == ' T' || topology[i] == ' t ' ) {
3279
3296
/* we've got a new thread */
3280
3297
}
3281
3298
/* check if we are at the position seeking for */
0 commit comments