- Add mpi_stub.h providing all MPI types/constants/functions as no-ops (nprocs=1, myrank=0) with memcpy-based Allreduce and clock_gettime Wtime - Replace #include <mpi.h> with conditional #ifdef MPI_STUB in 31 files (19 headers + 12 source files) preserving ability to build with real MPI - Change makefile.inc: CLINKER mpiicpx->icpx, add -DMPI_STUB to CXXAPPFLAGS - Update makefile_and_run.py: run ./ABE directly instead of mpirun -np N - Set MPI_processes=1 in AMSS_NCKU_Input.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
997 B
C
48 lines
997 B
C
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdarg.h>
|
|
#include <string.h>
|
|
|
|
#ifdef MPI_STUB
|
|
#include "mpi_stub.h"
|
|
#else
|
|
#include <mpi.h>
|
|
#endif
|
|
|
|
#include "myglobal.h"
|
|
|
|
int CCTK_VInfo(const char *thorn, const char *format, ...)
|
|
{
|
|
int myrank;
|
|
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
|
|
if (myrank !=0) return 0;
|
|
|
|
va_list ap;
|
|
va_start (ap, format);
|
|
fprintf (stdout, "INFO (%s): ", thorn);
|
|
vfprintf (stdout, format, ap);
|
|
fprintf (stdout, "\n");
|
|
va_end (ap);
|
|
return 0;
|
|
}
|
|
int CCTK_VWarn (int level,
|
|
int line,
|
|
const char *file,
|
|
const char *thorn,
|
|
const char *format,
|
|
...)
|
|
{
|
|
int myrank;
|
|
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
|
|
if (myrank !=0) return 0;
|
|
|
|
va_list ap;
|
|
va_start (ap, format);
|
|
fprintf (stdout, "WARN (%s): ", thorn);
|
|
vfprintf (stdout, format, ap);
|
|
fprintf (stdout, "\n");
|
|
va_end (ap);
|
|
return 0;
|
|
}
|