Closed sunsirui closed 3 years ago
Hi Sirui,
This is expected behavior. Doing actual computation in a skeleton (such as in compute_on_host()) doesn't actually advance simulator time. Accounting for computation needs to be done explicitly. There are a number of ways to do this. The most straightforward examples would be sleep() and compute() in operating_system.h. We've been experimenting with more sophisticated compiler-based approaches, but the toolchain is pretty tricky to get working.
--Joe
This paper: https://www.osti.gov/servlets/purl/1513073
And Chapter 6 of the sst-macro manual talk about the source-to-source approach.
These are also good background reading for computation modeling in sst-macro.
--Joe
Hi jpkenny,
Thank you very much for your reply! I will use nanosleep() function in time.h, for I want to use a nano level time delay.
Thanks, --Sirui
Dear All,
I have one question about the SST-Macro implementation of the MPI_Wtime In the following example, if the MPI_Wtime function is called twice in a row, the time obtained twice will be the same (unless other MPI functions are called in the middle, which will produce different times) Some questions:
DIM 25
static float *a; static float x; static float *y;
void allocate_host_arrays() {
int i=0, j=0; a = (float *)malloc(DIM sizeof(float *));
}
void compute_on_host() { int i = 0, j = 0; for (i = 0; i < DIM; i++) for (j = 0; j < DIM; j++) x[i] = x[i] + a[i][j]*a[j][i] + y[j]; }
static inline void do_compute_cpu(double target_seconds) { double t1 = 0.0, t2 = 0.0; double time_elapsed = 0.0; while (time_elapsed < target_seconds) { t1 = MPI_Wtime(); compute_on_host(); t2 = MPI_Wtime(); time_elapsed += (t2-t1); // the time_elapsed always is zero } }
Thanks to anyone who may shed some light into this. -sirui