-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change run.sh to allow for MPI typechecking tests
When executed with --mpi_intercept the script now uses mpic++ to compile the source files and mpirun -n 2 to run the resulting program.
- Loading branch information
1 parent
b8295b9
commit 82c6a64
Showing
2 changed files
with
42 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %run %s --mpi_intercept 2>&1 | FileCheck %s | ||
|
||
#include <mpi.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char** argv) { | ||
MPI_Init(&argc, &argv); | ||
|
||
// CHECK: [Trace] TypeART Runtime Trace | ||
|
||
// CHECK: [Trace] Alloc 0x{{.*}} double 8 16 | ||
const auto n = 16; | ||
auto f = new double[n]; | ||
|
||
int rank; | ||
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | ||
|
||
if (rank == 0) { | ||
MPI_Send(f, n, MPI_DOUBLE, 1, 0, MPI_COMM_WORLD); | ||
} else { | ||
MPI_Recv(f, n, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
} | ||
|
||
// CHECK: [Trace] Free 0x{{.*}} | ||
delete[] f; | ||
|
||
MPI_Finalize(); | ||
return 0; | ||
} |