Skip to content

Commit c3b73df

Browse files
matthiasdienerevan-charmworks
authored andcommitted
AMPI: fix exit code handling for bigsim, multicore, ucx, uth (#2478)
1 parent 3232ac9 commit c3b73df

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

src/arch/ucx/machine.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ void LrtsExit(int exitcode)
654654

655655
ret = runtime_fini();
656656
UCX_CHECK_PMI_RET(ret, "runtime_fini");
657-
exit(0);
657+
exit(exitcode);
658658
}
659659
}
660660

src/arch/uth/machine.C

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void CmiReleaseCommHandle(CmiCommHandle c)
7171
}
7272

7373
/********************* CONTEXT-SWITCHING FUNCTIONS ******************/
74+
static int _exitcode = 0;
7475

7576
static void CmiNext(void)
7677
{
@@ -81,7 +82,7 @@ static void CmiNext(void)
8182
t = CmiThreads[index];
8283
if ((t)&&(!CmiBarred[index])) break;
8384
index = (index+1) % CmiNumPes();
84-
if (index == orig) exit(0);
85+
if (index == orig) exit(_exitcode);
8586
}
8687
_Cmi_mype = index;
8788
CthResume(t);
@@ -314,6 +315,7 @@ void ConverseExit(int exitcode)
314315
{
315316
ConverseCommonExit();
316317
CmiThreads[CmiMyPe()] = 0;
318+
_exitcode = exitcode; // Used in CmiNext()
317319
CmiNext();
318320
}
319321

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ if (MSG_STATISTIC)
17161716
if (CmiMyRank() == 0) CmiExitXpmem();
17171717
CmiNodeAllBarrier();
17181718
#endif
1719-
if (CmiMyRank() == 0) LrtsExit();
1719+
if (CmiMyRank() == 0) LrtsExit(exitcode);
17201720
#endif
17211721
CmiYield();
17221722
if (!CharmLibInterOperate || userDrivenMode) {

tests/ampi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ endif
1818
NOBGDIRS = \
1919
intercomm_coll \
2020
privatization \
21+
exit \
2122
datatype \
2223

2324
FTDIRS = \

0 commit comments

Comments
 (0)