Skip to content

Commit a2182a9

Browse files
cmiArgDebugFlag and CMK_CCS_AVAILABLE fixes (#2711) (#2730)
Make cmiArgDebugFlag a process/node level global variable Previously, cmiArgDebugFlag was a Cpv variable, even though there was no need to have it as a PE-private variable. This change makes cmiArgDebugFlag a node-level global variable, which is initialized in ConverseInit. Additionally, this change also removes the macro that set CMK_CCS_AVAILABLE in conv-common.h for the UCX machine layer. Unlike other layers, CMK_CCS_AVAILABLE was separately set for the UCX layer in conv-common.h. By default, for all layers, CMK_CCS_AVAILABLE is set to 1 by the configure script, unless specifically disabled. Co-authored-by: Evan Ramos <[email protected]>
1 parent 7e7a0b2 commit a2182a9

File tree

9 files changed

+16
-30
lines changed

9 files changed

+16
-30
lines changed

src/arch/netlrts/machine.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static void KillOnAllSigs(int sigNo)
361361
already_in_signal_handler=1;
362362

363363
#if CMK_CCS_AVAILABLE
364-
if (CpvAccess(cmiArgDebugFlag)) {
364+
if (cmiArgDebugFlag && CmiMyRank() == 0) {
365365
int reply = 0;
366366
CpdNotify(CPD_SIGNAL,sigNo);
367367
#if ! CMK_BIGSIM_CHARM

src/arch/ucx/conv-common.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454
to a processors are implemented in convcore.c (1) or in machine.C (1). */
5555
#define CMK_VECTOR_SEND_USES_COMMON_CODE 1
5656

57-
/* Enable the CCS protocol if set to 1. */
58-
#define CMK_CCS_AVAILABLE 1
59-
6057
/* Defines if there is a "charmrun" program running on the system, which
6158
interacts with possible connecting clients (0), or if there is no such
6259
program, and processor 0 does the job (1). Currently only netlrts- and

src/arch/util/machine-common-core.C

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,12 @@ if ( MSG_STATISTIC)
14591459
}
14601460
#endif
14611461

1462+
if(CmiGetArgFlagDesc(argv, "+cpd", "Used *only* in conjunction with parallel debugger")) {
1463+
#if CMK_CCS_AVAILABLE
1464+
cmiArgDebugFlag = 1;
1465+
#endif
1466+
}
1467+
14621468
/* CmiTimerInit(); */
14631469
#if CMK_BROADCAST_HYPERCUBE
14641470
/* CmiNodesDim = ceil(log2(CmiNumNodes)) except when #nodes is 1*/
@@ -1497,22 +1503,6 @@ static void ConverseRunPE(int everReturn) {
14971503
CmiState cs;
14981504
char** CmiMyArgv;
14991505

1500-
#if CMK_CCS_AVAILABLE
1501-
/**
1502-
* The reason to initialize this variable here:
1503-
* cmiArgDebugFlag is possibly accessed in CmiPrintf/CmiError etc.,
1504-
* therefore, we have to initialize this variable before any calls
1505-
* to those functions (such as CmiPrintf). Otherwise, we may encounter
1506-
* a memory segmentation fault (bad memory access). Note, even
1507-
* testing CpvInitialized(cmiArgDebugFlag) doesn't help to solve
1508-
* this problem because the variable indicating whether cmiArgDebugFlag is
1509-
* initialized or not is not initialized, thus possibly causing another
1510-
* bad memory access. --Chao Mei
1511-
*/
1512-
CpvInitialize(int, cmiArgDebugFlag);
1513-
CpvAccess(cmiArgDebugFlag) = 0;
1514-
#endif
1515-
15161506
LrtsPreCommonInit(everReturn);
15171507

15181508
#if CMK_OFFLOAD_BCAST_PROCESS

src/arch/verbs/machine.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static void KillOnAllSigs(int sigNo)
350350
already_in_signal_handler=1;
351351

352352
#if CMK_CCS_AVAILABLE
353-
if (CpvAccess(cmiArgDebugFlag)) {
353+
if (cmiArgDebugFlag && CmiMyRank() == 0) {
354354
int reply = 0;
355355
CpdNotify(CPD_SIGNAL,sigNo);
356356
#if ! CMK_BIGSIM_CHARM

src/ck-core/debug-charm.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int CpdInUserCode() {return cpdInSystem==0 && _debugData.length()>0 && _debugDat
6969
// Function called right before an entry method
7070
void CpdBeforeEp(int ep, void *obj, void *msg) {
7171
#if CMK_CHARMDEBUG
72-
if (CpvAccess(cmiArgDebugFlag)) {
72+
if (cmiArgDebugFlag && CmiMyRank() == 0) {
7373
DebugRecursiveEntry entry;
7474
entry.previousChareID = setMemoryChareIDFromPtr(obj);
7575
entry.alreadyUserCode = _entryTable[ep]->inCharm ? 0 : 1;
@@ -99,7 +99,7 @@ void CpdBeforeEp(int ep, void *obj, void *msg) {
9999
// Function called right after an entry method
100100
void CpdAfterEp(int ep) {
101101
#if CMK_CHARMDEBUG
102-
if (CpvAccess(cmiArgDebugFlag)) {
102+
if (cmiArgDebugFlag && CmiMyRank() == 0) {
103103
DebugRecursiveEntry entry = _debugData.peek();
104104
std::vector<DebugPersistentCheck> &postExecutes = CkpvAccess(_debugEntryTable)[ep].postProcess;
105105
for (int i=0; i<postExecutes.size(); ++i) {

src/conv-ccs/conv-ccs.C

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ int _isCcsHandlerIdx(int hIdx) {
538538

539539
void CcsBuiltinsInit(char **argv);
540540

541-
CpvDeclare(int, cmiArgDebugFlag);
541+
int cmiArgDebugFlag; // Value is 0, unless reset in ConverseCommonInit
542542
CpvDeclare(char *, displayArgument);
543543
CpvCExtern(int, cpdSuspendStartup);
544544
CpvDeclare(int, cpdSuspendStartup);
@@ -583,9 +583,8 @@ void CcsInit(char **argv)
583583
}
584584
#endif
585585
/* if in parallel debug mode i.e ++cpd, freeze */
586-
if (CmiGetArgFlagDesc(argv, "+cpd", "Used *only* in conjunction with parallel debugger"))
586+
if (cmiArgDebugFlag && CmiMyRank() == 0)
587587
{
588-
if(CmiMyRank() == 0) CpvAccess(cmiArgDebugFlag) = 1;
589588
if (CmiGetArgStringDesc(argv, "+DebugDisplay",&(CpvAccess(displayArgument)), "X display for gdb used only in cpd mode"))
590589
{
591590
if (CpvAccess(displayArgument) == NULL)

src/conv-core/convcore.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3964,7 +3964,7 @@ void CmiPrintf(const char *format, ...)
39643964
}
39653965
va_end(args);
39663966
#if CMK_CCS_AVAILABLE && CMK_CMIPRINTF_IS_A_BUILTIN
3967-
if (CpvAccess(cmiArgDebugFlag)) {
3967+
if (cmiArgDebugFlag && CmiMyRank() == 0) {
39683968
va_start(args,format);
39693969
print_node0(format, args);
39703970
va_end(args);
@@ -3984,7 +3984,7 @@ void CmiError(const char *format, ...)
39843984
CmiFlush(stderr); /* stderr is always flushed */
39853985
va_end(args);
39863986
#if CMK_CCS_AVAILABLE && CMK_CMIPRINTF_IS_A_BUILTIN
3987-
if (CpvAccess(cmiArgDebugFlag)) {
3987+
if (cmiArgDebugFlag && CmiMyRank() == 0) {
39883988
va_start(args,format);
39893989
print_node0(format, args);
39903990
va_end(args);

src/conv-core/debug-conv.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ void CpdInit(void)
371371
/* If CharmDebug is attached, try to send it a message and wait */
372372
void CpdAborting(const char *message) {
373373
#if CMK_CCS_AVAILABLE
374-
if (CpvAccess(cmiArgDebugFlag)) {
374+
if (cmiArgDebugFlag && CmiMyRank() == 0) {
375375
CpdNotify(CPD_ABORT, message);
376376
CpdFreeze();
377377
}

src/conv-core/debug-conv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extern void (*CpdDebug_pupMemStat)(pup_er p, void *data);
2626
extern void (*CpdDebug_deleteMemStat)(void *ptr);
2727
extern void * (*CpdDebug_mergeMemStat)(int *size, void *data, void **remoteData, int numRemote);
2828

29-
CpvExtern(int, cmiArgDebugFlag);
29+
extern int cmiArgDebugFlag; // Value is 0, unless reset in ConverseCommonInit
3030
extern char ** memoryBackup;
3131
extern void CpdCheckMemory(void);
3232
extern void CpdResetMemory(void);

0 commit comments

Comments
 (0)