|
| 1 | +From 82487c29f5737b8f4c959a8dfc148d52deed0c51 Mon Sep 17 00:00:00 2001 |
| 2 | +From: wkliao <wkliao@users.noreply.github.com> |
| 3 | +Date: Thu, 18 Apr 2024 15:44:46 -0500 |
| 4 | +Subject: [PATCH] print number of calls to memcpy() |
| 5 | + |
| 6 | +--- |
| 7 | + src/mpi/romio/adio/common/ad_write_coll.c | 6 ++++++ |
| 8 | + 1 file changed, 6 insertions(+) |
| 9 | + |
| 10 | +diff --git a/src/mpi/romio/adio/common/ad_write_coll.c b/src/mpi/romio/adio/common/ad_write_coll.c |
| 11 | +index 2b7ed69f..84c5875d 100644 |
| 12 | +--- a/src/mpi/romio/adio/common/ad_write_coll.c |
| 13 | ++++ b/src/mpi/romio/adio/common/ad_write_coll.c |
| 14 | +@@ -10,6 +10,8 @@ |
| 15 | + #include "mpe.h" |
| 16 | + #endif |
| 17 | + |
| 18 | ++static int num_memcpy; |
| 19 | ++ |
| 20 | + /* prototypes of functions used for collective writes only. */ |
| 21 | + static void ADIOI_Exch_and_write(ADIO_File fd, void *buf, MPI_Datatype |
| 22 | + datatype, int nprocs, int myrank, |
| 23 | +@@ -78,6 +80,7 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, MPI_Aint count, |
| 24 | + ADIO_Offset *len_list = NULL; |
| 25 | + int old_error, tmp_error; |
| 26 | + |
| 27 | ++num_memcpy = 0; |
| 28 | + if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) { |
| 29 | + /* Cast away const'ness as the below function is used for read |
| 30 | + * and write */ |
| 31 | +@@ -247,6 +250,8 @@ void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, MPI_Aint count, |
| 32 | + #ifdef AGGREGATION_PROFILE |
| 33 | + MPE_Log_event(5013, 0, NULL); |
| 34 | + #endif |
| 35 | ++ |
| 36 | ++if (fd->is_agg) printf("rank %d: %s number of memcpy called = %d\n",myrank,__func__,num_memcpy); |
| 37 | + } |
| 38 | + |
| 39 | + |
| 40 | +@@ -791,6 +796,7 @@ static void ADIOI_W_Exchange_data(ADIO_File fd, void *buf, char *write_buf, |
| 41 | + ADIOI_Assert(size_in_buf == (size_t)size_in_buf); \ |
| 42 | + memcpy(&(send_buf[p][send_buf_idx[p]]), \ |
| 43 | + ((char *) buf) + user_buf_idx, size_in_buf); \ |
| 44 | ++num_memcpy++; \ |
| 45 | + send_buf_idx[p] += size_in_buf; \ |
| 46 | + user_buf_idx += size_in_buf; \ |
| 47 | + flat_buf_sz -= size_in_buf; \ |
| 48 | +-- |
| 49 | +2.39.3 |
| 50 | + |
0 commit comments