diff --git a/configure.ac b/configure.ac index 64eab61b8fa..c4e7b7e57ff 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. -# Copyright (c) 2004-2015 The University of Tennessee and The University +# Copyright (c) 2004-2018 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, @@ -287,6 +287,24 @@ AS_IF([test "$enable_oshmem" != "no"], [project_oshmem_amc=true], [project_oshme m4_ifndef([project_oshmem], [project_oshmem_amc=false]) AM_CONDITIONAL([PROJECT_OSHMEM], [test "$project_oshmem_amc" = "true"]) +# Enable/Disable Software-Based Performance Counters Capability +AC_ARG_ENABLE(spc, + AC_HELP_STRING([--enable-spc], + [Enable software-based performance counters capability (default: disabled)])) +if test "$enable_spc" = "yes"; then + AC_MSG_RESULT([yes]) + SPC_ENABLE=1 +else + AC_MSG_RESULT([no]) + SPC_ENABLE=0 +fi +AC_DEFINE_UNQUOTED([SPC_ENABLE], + [$SPC_ENABLE], + [If the software-based performance counters capability should be enabled.]) +AM_CONDITIONAL(SPC_ENABLE, test "$SPC_ENABLE" = "1") + +AS_IF([test "$enable_spc" != "no"], [project_spc_amc=true], [project_spc_amc=false]) + if test "$enable_binaries" = "no" && test "$enable_dist" = "yes"; then AC_MSG_WARN([--disable-binaries is incompatible with --enable dist]) AC_MSG_ERROR([Cannot continue]) @@ -1427,7 +1445,7 @@ AC_CONFIG_FILES([ test/util/Makefile ]) -m4_ifdef([project_ompi], [AC_CONFIG_FILES([test/monitoring/Makefile])]) +m4_ifdef([project_ompi], [AC_CONFIG_FILES([test/monitoring/Makefile test/spc/Makefile])]) AC_CONFIG_FILES([contrib/dist/mofed/debian/rules], [chmod +x contrib/dist/mofed/debian/rules]) diff --git a/examples/Makefile b/examples/Makefile index 86ce69b2b5c..f7d76874ced 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -2,7 +2,7 @@ # Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University +# Copyright (c) 2004-2018 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -67,14 +67,15 @@ EXAMPLES = \ oshmem_circular_shift \ oshmem_max_reduction \ oshmem_strided_puts \ - oshmem_symmetric_data + oshmem_symmetric_data \ + spc_example # Default target. Always build the C MPI examples. Only build the # others if we have the appropriate Open MPI / OpenSHMEM language # bindings. -all: hello_c ring_c connectivity_c +all: hello_c ring_c connectivity_c spc_example @ if which ompi_info >/dev/null 2>&1 ; then \ $(MAKE) mpi; \ fi diff --git a/examples/Makefile.include b/examples/Makefile.include index ebf0eb9d370..ed9ace14088 100644 --- a/examples/Makefile.include +++ b/examples/Makefile.include @@ -3,7 +3,7 @@ # Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University +# Copyright (c) 2004-2018 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -57,4 +57,5 @@ EXTRA_DIST += \ examples/oshmem_strided_puts.c \ examples/oshmem_symmetric_data.c \ examples/Hello.java \ - examples/Ring.java + examples/Ring.java \ + examples/spc_example.c diff --git a/examples/spc_example.c b/examples/spc_example.c new file mode 100644 index 00000000000..b98b90f4f0d --- /dev/null +++ b/examples/spc_example.c @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * + * Simple example usage of SPCs through MPI_T. + */ + +#include +#include +#include + +#include + +/* Sends 'num_messages' messages of 'message_size' bytes from rank 0 to rank 1. + * All messages are send synchronously and with the same tag in MPI_COMM_WORLD. + */ +void message_exchange(int num_messages, int message_size) +{ + int i, rank; + /* Use calloc to initialize data to 0's */ + char *data = (char*)calloc(message_size, sizeof(char)); + MPI_Status status; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + if(rank == 0) { + for(i = 0; i < num_messages; i++) + MPI_Send(data, message_size, MPI_BYTE, 1, 123, MPI_COMM_WORLD); + } else if(rank == 1) { + for(i = 0; i < num_messages; i++) + MPI_Recv(data, message_size, MPI_BYTE, 0, 123, MPI_COMM_WORLD, &status); + } + + free(data); +} + +int main(int argc, char **argv) +{ + int num_messages, message_size; + + if(argc < 3) { + printf("Usage: mpirun -np 2 --mca mpi_spc_attach all --mca mpi_spc_dump_enabled true ./test [num_messages] [message_size]\n"); + return -1; + } else { + num_messages = atoi(argv[1]); + message_size = atoi(argv[2]); + } + + int i, rank, size, provided, num, name_len, desc_len, verbosity, bind, var_class, readonly, continuous, atomic, count, index; + MPI_Datatype datatype; + MPI_T_enum enumtype; + MPI_Comm comm; + char name[256], description[256]; + + /* Counter names to be read by ranks 0 and 1 */ + char counter_names[2][40]; + sprintf(counter_names[0], "runtime_spc_OMPI_BYTES_SENT_USER"); + sprintf(counter_names[1], "runtime_spc_OMPI_BYTES_RECEIVED_USER"); + + MPI_Init(NULL, NULL); + MPI_T_init_thread(MPI_THREAD_SINGLE, &provided); + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + if(size != 2) { + fprintf(stderr, "ERROR: This test should be run with two MPI processes.\n"); + return -1; + } + + /* Determine the MPI_T pvar indices for the OMPI_BYTES_SENT/RECIEVED_USER SPCs */ + index = -1; + MPI_T_pvar_get_num(&num); + for(i = 0; i < num; i++) { + name_len = desc_len = 256; + PMPI_T_pvar_get_info(i, name, &name_len, &verbosity, + &var_class, &datatype, &enumtype, description, &desc_len, &bind, + &readonly, &continuous, &atomic); + if(strcmp(name, counter_names[rank]) == 0) { + index = i; + printf("[%d] %s -> %s\n", rank, name, description); + } + } + + /* Make sure we found the counters */ + if(index == -1) { + fprintf(stderr, "ERROR: Couldn't find the appropriate SPC counter in the MPI_T pvars.\n"); + return -1; + } + + int ret; + long long value; + + MPI_T_pvar_session session; + MPI_T_pvar_handle handle; + /* Create the MPI_T sessions/handles for the counters and start the counters */ + ret = MPI_T_pvar_session_create(&session); + ret = MPI_T_pvar_handle_alloc(session, index, NULL, &handle, &count); + ret = MPI_T_pvar_start(session, handle); + + message_exchange(num_messages, message_size); + + ret = MPI_T_pvar_read(session, handle, &value); + /* Print the counter values in order by rank */ + for(i = 0; i < 2; i++) { + if(i == rank) { + printf("[%d] Value Read: %lld\n", rank, value); + fflush(stdout); + } + MPI_Barrier(MPI_COMM_WORLD); + } + /* Stop the MPI_T session, free the handle, and then free the session */ + ret = MPI_T_pvar_stop(session, handle); + ret = MPI_T_pvar_handle_free(session, &handle); + ret = MPI_T_pvar_session_free(&session); + + MPI_T_finalize(); + MPI_Finalize(); + + return 0; +} diff --git a/ompi/mca/pml/ob1/pml_ob1.c b/ompi/mca/pml/ob1/pml_ob1.c index 5adf19028a8..56524892786 100644 --- a/ompi/mca/pml/ob1/pml_ob1.c +++ b/ompi/mca/pml/ob1/pml_ob1.c @@ -36,6 +36,7 @@ #include "opal_stdint.h" #include "opal/mca/btl/btl.h" #include "opal/mca/btl/base/base.h" +#include "ompi/runtime/ompi_spc.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/pml/base/base.h" diff --git a/ompi/mca/pml/ob1/pml_ob1_isend.c b/ompi/mca/pml/ob1/pml_ob1_isend.c index be673382761..b019b7a980a 100644 --- a/ompi/mca/pml/ob1/pml_ob1_isend.c +++ b/ompi/mca/pml/ob1/pml_ob1_isend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2015 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -28,6 +28,7 @@ #include "pml_ob1_sendreq.h" #include "pml_ob1_recvreq.h" #include "ompi/peruse/peruse-internal.h" +#include "ompi/runtime/ompi_spc.h" /** * Single usage request. As we allow recursive calls (as an @@ -119,6 +120,11 @@ static inline int mca_pml_ob1_send_inline (const void *buf, size_t count, rc = mca_bml_base_sendi (bml_btl, &convertor, &match, OMPI_PML_OB1_MATCH_HDR_LEN, size, MCA_BTL_NO_ORDER, MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP, MCA_PML_OB1_HDR_TYPE_MATCH, NULL); + + if(OPAL_LIKELY(rc == OPAL_SUCCESS)) { + SPC_USER_OR_MPI(tag, (long long)size, OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); + } + if (count > 0) { opal_convertor_cleanup (&convertor); } diff --git a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c index eb261029ffd..8c6ec93b503 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c @@ -39,6 +39,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/peruse/peruse-internal.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #include "pml_ob1.h" #include "pml_ob1_comm.h" @@ -314,9 +315,8 @@ check_cantmatch_for_match(mca_pml_ob1_comm_proc_t *proc) { mca_pml_ob1_recv_frag_t *frag = proc->frags_cant_match; - if( (NULL != frag) && (frag->hdr.hdr_match.hdr_seq == proc->expected_sequence) ) { + if( (NULL != frag) && (frag->hdr.hdr_match.hdr_seq == proc->expected_sequence) ) return remove_head_from_ordered_list(&proc->frags_cant_match); - } return NULL; } @@ -388,6 +388,7 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl, MCA_PML_OB1_RECV_FRAG_ALLOC(frag); MCA_PML_OB1_RECV_FRAG_INIT(frag, hdr, segments, num_segments, btl); append_frag_to_ordered_list(&proc->frags_cant_match, frag, proc->expected_sequence); + SPC_RECORD(OMPI_OUT_OF_SEQUENCE, 1); OB1_MATCHING_UNLOCK(&comm->matching_lock); return; } @@ -453,6 +454,8 @@ void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t* btl, &iov_count, &bytes_received ); match->req_bytes_received = bytes_received; + SPC_USER_OR_MPI(match->req_recv.req_base.req_ompi.req_status.MPI_TAG, (long long)bytes_received, + OMPI_BYTES_RECEIVED_USER, OMPI_BYTES_RECEIVED_MPI); /* * Unpacking finished, make the user buffer unaccessable again. */ @@ -777,6 +780,11 @@ match_one(mca_btl_base_module_t *btl, mca_pml_ob1_comm_proc_t *proc, mca_pml_ob1_recv_frag_t* frag) { +#if SPC_ENABLE == 1 + opal_timer_t timer = 0; +#endif + SPC_TIMER_START(OMPI_MATCH_TIME, &timer); + mca_pml_ob1_recv_request_t *match; mca_pml_ob1_comm_t *comm = (mca_pml_ob1_comm_t *)comm_ptr->c_pml_comm; @@ -814,19 +822,25 @@ match_one(mca_btl_base_module_t *btl, num_segments); /* this frag is already processed, so we want to break out of the loop and not end up back on the unexpected queue. */ + SPC_TIMER_STOP(OMPI_MATCH_TIME, &timer); return NULL; } PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_MSG_MATCH_POSTED_REQ, &(match->req_recv.req_base), PERUSE_RECV); + SPC_TIMER_STOP(OMPI_MATCH_TIME, &timer); return match; } /* if no match found, place on unexpected queue */ append_frag_to_list(&proc->unexpected_frags, btl, hdr, segments, num_segments, frag); + SPC_RECORD(OMPI_UNEXPECTED, 1); + SPC_RECORD(OMPI_UNEXPECTED_IN_QUEUE, 1); + SPC_UPDATE_WATERMARK(OMPI_MAX_UNEXPECTED_IN_QUEUE, OMPI_UNEXPECTED_IN_QUEUE); PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_INSERT_IN_UNEX_Q, comm_ptr, hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); + SPC_TIMER_STOP(OMPI_MATCH_TIME, &timer); return NULL; } while(true); } @@ -920,6 +934,11 @@ static int mca_pml_ob1_recv_frag_match( mca_btl_base_module_t *btl, MCA_PML_OB1_RECV_FRAG_ALLOC(frag); MCA_PML_OB1_RECV_FRAG_INIT(frag, hdr, segments, num_segments, btl); append_frag_to_ordered_list(&proc->frags_cant_match, frag, next_msg_seq_expected); + + SPC_RECORD(OMPI_OUT_OF_SEQUENCE, 1); + SPC_RECORD(OMPI_OOS_IN_QUEUE, 1); + SPC_UPDATE_WATERMARK(OMPI_MAX_OOS_IN_QUEUE, OMPI_OOS_IN_QUEUE); + OB1_MATCHING_UNLOCK(&comm->matching_lock); return OMPI_SUCCESS; } diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.c b/ompi/mca/pml/ob1/pml_ob1_recvreq.c index 9ccb27e1af4..502f04e0694 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -29,6 +29,7 @@ #include "opal/mca/mpool/mpool.h" #include "opal/util/arch.h" +#include "ompi/runtime/ompi_spc.h" #include "ompi/mca/pml/pml.h" #include "ompi/mca/bml/bml.h" #include "pml_ob1_comm.h" @@ -199,6 +200,8 @@ static void mca_pml_ob1_put_completion (mca_pml_ob1_rdma_frag_t *frag, int64_t r /* check completion status */ OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, rdma_size); + SPC_USER_OR_MPI(recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG, (long long)rdma_size, + OMPI_BYTES_RECEIVED_USER, OMPI_BYTES_RECEIVED_MPI); if (recv_request_pml_complete_check(recvreq) == false && recvreq->req_rdma_offset < recvreq->req_send_offset) { /* schedule additional rdma operations */ @@ -242,6 +245,7 @@ int mca_pml_ob1_recv_request_ack_send_btl( des->des_cbfunc = mca_pml_ob1_recv_ctl_completion; rc = mca_bml_base_send(bml_btl, des, MCA_PML_OB1_HDR_TYPE_ACK); + SPC_RECORD(OMPI_BYTES_RECEIVED_MPI, (long long)size); if( OPAL_LIKELY( rc >= 0 ) ) { return OMPI_SUCCESS; } @@ -374,6 +378,8 @@ static void mca_pml_ob1_rget_completion (mca_btl_base_module_t* btl, struct mca_ } else { /* is receive request complete */ OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, frag->rdma_length); + SPC_USER_OR_MPI(recvreq->req_recv.req_base.req_tag, (long long)frag->rdma_length, + OMPI_BYTES_RECEIVED_USER, OMPI_BYTES_RECEIVED_MPI); /* TODO: re-add order */ mca_pml_ob1_send_fin (recvreq->req_recv.req_base.req_proc, bml_btl, frag->rdma_hdr.hdr_rget.hdr_frag, @@ -429,6 +435,8 @@ static int mca_pml_ob1_recv_request_put_frag (mca_pml_ob1_rdma_frag_t *frag) /* send rdma request to peer */ rc = mca_bml_base_send (bml_btl, ctl, MCA_PML_OB1_HDR_TYPE_PUT); + /* Increment counter for bytes_put even though they probably haven't all been received yet */ + SPC_RECORD(OMPI_BYTES_PUT, frag->rdma_length); if (OPAL_UNLIKELY(rc < 0)) { mca_bml_base_free (bml_btl, ctl); return rc; @@ -470,6 +478,8 @@ int mca_pml_ob1_recv_request_get_frag (mca_pml_ob1_rdma_frag_t *frag) rc = mca_bml_base_get (bml_btl, frag->local_address, frag->remote_address, local_handle, (mca_btl_base_registration_handle_t *) frag->remote_handle, frag->rdma_length, 0, MCA_BTL_NO_ORDER, mca_pml_ob1_rget_completion, frag); + /* Increment counter for bytes_get even though they probably haven't all been received yet */ + SPC_RECORD(OMPI_BYTES_GET, frag->rdma_length); if( OPAL_UNLIKELY(OMPI_SUCCESS > rc) ) { return mca_pml_ob1_recv_request_get_frag_failed (frag, OMPI_ERR_OUT_OF_RESOURCE); } @@ -525,6 +535,8 @@ void mca_pml_ob1_recv_request_progress_frag( mca_pml_ob1_recv_request_t* recvreq ); OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, bytes_received); + SPC_USER_OR_MPI(recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG, (long long)bytes_received, + OMPI_BYTES_RECEIVED_USER, OMPI_BYTES_RECEIVED_MPI); /* check completion status */ if(recv_request_pml_complete_check(recvreq) == false && recvreq->req_rdma_offset < recvreq->req_send_offset) { @@ -602,7 +614,8 @@ void mca_pml_ob1_recv_request_frag_copy_finished( mca_btl_base_module_t* btl, des->des_cbfunc(NULL, NULL, des, 0); OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, bytes_received); - + SPC_USER_OR_MPI(recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG, (long long)bytes_received, + OMPI_BYTES_RECEIVED_USER, OMPI_BYTES_RECEIVED_MPI); /* check completion status */ if(recv_request_pml_complete_check(recvreq) == false && recvreq->req_rdma_offset < recvreq->req_send_offset) { @@ -816,6 +829,8 @@ void mca_pml_ob1_recv_request_progress_rndv( mca_pml_ob1_recv_request_t* recvreq recvreq->req_recv.req_base.req_datatype); ); OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, bytes_received); + SPC_USER_OR_MPI(recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG, (long long)bytes_received, + OMPI_BYTES_RECEIVED_USER, OMPI_BYTES_RECEIVED_MPI); } /* check completion status */ if(recv_request_pml_complete_check(recvreq) == false && @@ -886,6 +901,8 @@ void mca_pml_ob1_recv_request_progress_match( mca_pml_ob1_recv_request_t* recvre * for this request. */ recvreq->req_bytes_received += bytes_received; + SPC_USER_OR_MPI(recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG, (long long)bytes_received, + OMPI_BYTES_RECEIVED_USER, OMPI_BYTES_RECEIVED_MPI); recv_request_pml_complete(recvreq); } @@ -1228,6 +1245,7 @@ void mca_pml_ob1_recv_req_start(mca_pml_ob1_recv_request_t *req) opal_list_remove_item(&proc->unexpected_frags, (opal_list_item_t*)frag); + SPC_RECORD(OMPI_UNEXPECTED_IN_QUEUE, -1); OB1_MATCHING_UNLOCK(&ob1_comm->matching_lock); switch(hdr->hdr_common.hdr_type) { @@ -1258,6 +1276,7 @@ void mca_pml_ob1_recv_req_start(mca_pml_ob1_recv_request_t *req) restarted with this request during mrecv */ opal_list_remove_item(&proc->unexpected_frags, (opal_list_item_t*)frag); + SPC_RECORD(OMPI_UNEXPECTED_IN_QUEUE, -1); OB1_MATCHING_UNLOCK(&ob1_comm->matching_lock); req->req_recv.req_base.req_addr = frag; diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.c b/ompi/mca/pml/ob1/pml_ob1_sendreq.c index a2aecae09ac..b51bfe1c814 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2016 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -29,6 +29,7 @@ #include "ompi_config.h" #include "opal/prefetch.h" #include "opal/mca/mpool/mpool.h" +#include "ompi/runtime/ompi_spc.h" #include "ompi/constants.h" #include "ompi/mca/pml/pml.h" #include "pml_ob1.h" @@ -39,7 +40,6 @@ #include "ompi/mca/bml/base/base.h" #include "ompi/memchecker.h" - OBJ_CLASS_INSTANCE(mca_pml_ob1_send_range_t, opal_free_list_item_t, NULL, NULL); @@ -206,6 +206,8 @@ mca_pml_ob1_rndv_completion_request( mca_bml_base_btl_t* bml_btl, } OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered); + SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, req_bytes_delivered, + OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); /* advance the request */ OPAL_THREAD_ADD_FETCH32(&sendreq->req_state, -1); @@ -262,6 +264,8 @@ mca_pml_ob1_rget_completion (mca_pml_ob1_rdma_frag_t *frag, int64_t rdma_length) /* count bytes of user data actually delivered and check for request completion */ if (OPAL_LIKELY(0 < rdma_length)) { OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, (size_t) rdma_length); + SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, rdma_length, + OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); } send_request_pml_complete_check(sendreq); @@ -315,6 +319,8 @@ mca_pml_ob1_frag_completion( mca_btl_base_module_t* btl, OPAL_THREAD_ADD_FETCH32(&sendreq->req_pipeline_depth, -1); OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered); + SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, req_bytes_delivered, + OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); if(send_request_pml_complete_check(sendreq) == false) { mca_pml_ob1_send_request_schedule(sendreq); @@ -497,6 +503,8 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq, &des); if( OPAL_LIKELY(OMPI_SUCCESS == rc) ) { /* signal request completion */ + SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, size, + OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); send_request_pml_complete(sendreq); return OMPI_SUCCESS; } @@ -567,6 +575,8 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq, /* send */ rc = mca_bml_base_send_status(bml_btl, des, MCA_PML_OB1_HDR_TYPE_MATCH); + SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, size, + OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); if( OPAL_LIKELY( rc >= OPAL_SUCCESS ) ) { if( OPAL_LIKELY( 1 == rc ) ) { mca_pml_ob1_match_completion_free_request( bml_btl, sendreq ); @@ -627,6 +637,8 @@ int mca_pml_ob1_send_request_start_prepare( mca_pml_ob1_send_request_t* sendreq, /* send */ rc = mca_bml_base_send(bml_btl, des, MCA_PML_OB1_HDR_TYPE_MATCH); + SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, size, + OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); if( OPAL_LIKELY( rc >= OPAL_SUCCESS ) ) { if( OPAL_LIKELY( 1 == rc ) ) { mca_pml_ob1_match_completion_free_request( bml_btl, sendreq ); @@ -1127,6 +1139,8 @@ static void mca_pml_ob1_put_completion (mca_btl_base_module_t* btl, struct mca_b /* check for request completion */ OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, frag->rdma_length); + SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, frag->rdma_length, + OMPI_BYTES_SENT_USER, OMPI_BYTES_SENT_MPI); send_request_pml_complete_check(sendreq); } else { @@ -1177,6 +1191,8 @@ int mca_pml_ob1_send_request_put_frag( mca_pml_ob1_rdma_frag_t *frag ) rc = mca_bml_base_put (bml_btl, frag->local_address, frag->remote_address, local_handle, (mca_btl_base_registration_handle_t *) frag->remote_handle, frag->rdma_length, 0, MCA_BTL_NO_ORDER, mca_pml_ob1_put_completion, frag); + /* Count the bytes put even though they probably haven't been sent yet */ + SPC_RECORD(OMPI_BYTES_PUT, frag->rdma_length); if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) { mca_pml_ob1_send_request_put_frag_failed (frag, rc); return rc; diff --git a/ompi/mpi/c/allgather.c b/ompi/mpi/c/allgather.c index 41df7adf386..aa7793ccf47 100644 --- a/ompi/mpi/c/allgather.c +++ b/ompi/mpi/c/allgather.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int err; + SPC_RECORD(OMPI_ALLGATHER, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/allgatherv.c b/ompi/mpi/c/allgatherv.c index 86668682fb5..80c1871af9e 100644 --- a/ompi/mpi/c/allgatherv.c +++ b/ompi/mpi/c/allgatherv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int i, size, err; + SPC_RECORD(OMPI_ALLGATHERV, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/allreduce.c b/ompi/mpi/c/allreduce.c index edfb7020c00..655e51d6300 100644 --- a/ompi/mpi/c/allreduce.c +++ b/ompi/mpi/c/allreduce.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, { int err; + SPC_RECORD(OMPI_ALLREDUCE, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_comm(comm); diff --git a/ompi/mpi/c/alltoall.c b/ompi/mpi/c/alltoall.c index c31bb724205..8b7b9c59f3d 100644 --- a/ompi/mpi/c/alltoall.c +++ b/ompi/mpi/c/alltoall.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -33,6 +33,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -51,6 +52,8 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int err; size_t recvtype_size; + SPC_RECORD(OMPI_ALLTOALL, 1); + MEMCHECKER( memchecker_comm(comm); if (MPI_IN_PLACE != sendbuf) { diff --git a/ompi/mpi/c/barrier.c b/ompi/mpi/c/barrier.c index 297e41b0a33..e0e328b8ae9 100644 --- a/ompi/mpi/c/barrier.c +++ b/ompi/mpi/c/barrier.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -25,6 +25,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -40,6 +41,8 @@ int MPI_Barrier(MPI_Comm comm) { int err = MPI_SUCCESS; + SPC_RECORD(OMPI_BARRIER, 1); + MEMCHECKER( memchecker_comm(comm); ); diff --git a/ompi/mpi/c/bcast.c b/ompi/mpi/c/bcast.c index 6715aff90de..586ef0e7ad7 100644 --- a/ompi/mpi/c/bcast.c +++ b/ompi/mpi/c/bcast.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -26,6 +26,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -36,12 +37,13 @@ static const char FUNC_NAME[] = "MPI_Bcast"; - int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) { int err; + SPC_RECORD(OMPI_BCAST, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_comm(comm); diff --git a/ompi/mpi/c/bsend.c b/ompi/mpi/c/bsend.c index 2d96328f5f8..785516c25b5 100644 --- a/ompi/mpi/c/bsend.c +++ b/ompi/mpi/c/bsend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/mca/pml/base/pml_base_bsend.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -46,6 +47,8 @@ int MPI_Bsend(const void *buf, int count, MPI_Datatype type, int dest, int tag, { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_BSEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/cancel.c b/ompi/mpi/c/cancel.c index 0b5db9e0e3d..f259ced177d 100644 --- a/ompi/mpi/c/cancel.c +++ b/ompi/mpi/c/cancel.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -28,6 +28,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -43,6 +44,8 @@ int MPI_Cancel(MPI_Request *request) { int rc; + SPC_RECORD(OMPI_CANCEL, 1); + MEMCHECKER( memchecker_request(request); ); diff --git a/ompi/mpi/c/finalize.c b/ompi/mpi/c/finalize.c index b640c6cec11..42404768dfb 100644 --- a/ompi/mpi/c/finalize.c +++ b/ompi/mpi/c/finalize.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -23,6 +23,7 @@ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/errhandler/errhandler.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -36,6 +37,12 @@ static const char FUNC_NAME[] = "MPI_Finalize"; int MPI_Finalize(void) { + /* If --with-spc and ompi_mpi_spc_dump_enabled were specified, print + * all of the final SPC values aggregated across the whole MPI run. + * Also, free all SPC memory. + */ + SPC_FINI(); + OPAL_CR_FINALIZE_LIBRARY(); if (MPI_PARAM_CHECK) { diff --git a/ompi/mpi/c/gather.c b/ompi/mpi/c/gather.c index 03a7bf63860..f8509c5b20f 100644 --- a/ompi/mpi/c/gather.c +++ b/ompi/mpi/c/gather.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int err; + SPC_RECORD(OMPI_GATHER, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/gatherv.c b/ompi/mpi/c/gatherv.c index c31cbaba1d6..c341b5095f6 100644 --- a/ompi/mpi/c/gatherv.c +++ b/ompi/mpi/c/gatherv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int i, size, err; + SPC_RECORD(OMPI_GATHERV, 1); + MEMCHECKER( ptrdiff_t ext; diff --git a/ompi/mpi/c/get.c b/ompi/mpi/c/get.c index 4f2e9037828..b35ab4e742c 100644 --- a/ompi/mpi/c/get.c +++ b/ompi/mpi/c/get.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/win/win.h" #include "ompi/mca/osc/osc.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Get(void *origin_addr, int origin_count, { int rc; + SPC_RECORD(OMPI_GET, 1); + if (MPI_PARAM_CHECK) { rc = OMPI_SUCCESS; diff --git a/ompi/mpi/c/iallgather.c b/ompi/mpi/c/iallgather.c index e8259305616..67c91fd1dea 100644 --- a/ompi/mpi/c/iallgather.c +++ b/ompi/mpi/c/iallgather.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int err; + SPC_RECORD(OMPI_IALLGATHER, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/iallgatherv.c b/ompi/mpi/c/iallgatherv.c index 0ec3c486702..bb28ce328e0 100644 --- a/ompi/mpi/c/iallgatherv.c +++ b/ompi/mpi/c/iallgatherv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int i, size, err; + SPC_RECORD(OMPI_IALLGATHERV, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/iallreduce.c b/ompi/mpi/c/iallreduce.c index a4ca64e4e45..709b159294d 100644 --- a/ompi/mpi/c/iallreduce.c +++ b/ompi/mpi/c/iallreduce.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, { int err; + SPC_RECORD(OMPI_IALLREDUCE, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_comm(comm); diff --git a/ompi/mpi/c/ialltoall.c b/ompi/mpi/c/ialltoall.c index 3e94236717d..232c1123efa 100644 --- a/ompi/mpi/c/ialltoall.c +++ b/ompi/mpi/c/ialltoall.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -50,6 +51,8 @@ int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, size_t sendtype_size, recvtype_size; int err; + SPC_RECORD(OMPI_IALLTOALL, 1); + MEMCHECKER( memchecker_comm(comm); if (MPI_IN_PLACE != sendbuf) { diff --git a/ompi/mpi/c/ialltoallv.c b/ompi/mpi/c/ialltoallv.c index 1997aa5e2fa..429297794ef 100644 --- a/ompi/mpi/c/ialltoallv.c +++ b/ompi/mpi/c/ialltoallv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl { int i, size, err; + SPC_RECORD(OMPI_IALLTOALLV, 1); + MEMCHECKER( ptrdiff_t recv_ext; ptrdiff_t send_ext; diff --git a/ompi/mpi/c/ialltoallw.c b/ompi/mpi/c/ialltoallw.c index 81c11aec7a1..82111c510ff 100644 --- a/ompi/mpi/c/ialltoallw.c +++ b/ompi/mpi/c/ialltoallw.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl { int i, size, err; + SPC_RECORD(OMPI_IALLTOALLW, 1); + MEMCHECKER( ptrdiff_t recv_ext; ptrdiff_t send_ext; diff --git a/ompi/mpi/c/ibarrier.c b/ompi/mpi/c/ibarrier.c index 76c45aa3bc3..45ec69c7192 100644 --- a/ompi/mpi/c/ibarrier.c +++ b/ompi/mpi/c/ibarrier.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -42,6 +43,8 @@ int MPI_Ibarrier(MPI_Comm comm, MPI_Request *request) { int err = MPI_SUCCESS; + SPC_RECORD(OMPI_IBARRIER, 1); + MEMCHECKER( memchecker_comm(comm); ); diff --git a/ompi/mpi/c/ibcast.c b/ompi/mpi/c/ibcast.c index 331d024ef3e..5eeaf5708ea 100644 --- a/ompi/mpi/c/ibcast.c +++ b/ompi/mpi/c/ibcast.c @@ -2,7 +2,7 @@ * Copyright (c) 2012 Oak Rigde National Laboratory. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 The University of Tennessee and The University + * Copyright (c) 2017-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * $COPYRIGHT$ @@ -20,6 +20,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -36,6 +37,8 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, { int err; + SPC_RECORD(OMPI_IBCAST, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_call(&opal_memchecker_base_isdefined, buffer, count, datatype); diff --git a/ompi/mpi/c/ibsend.c b/ompi/mpi/c/ibsend.c index ec9a127ab2c..89686c23e39 100644 --- a/ompi/mpi/c/ibsend.c +++ b/ompi/mpi/c/ibsend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/mca/pml/base/pml_base_bsend.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Ibsend(const void *buf, int count, MPI_Datatype type, int dest, { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_IBSEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/igather.c b/ompi/mpi/c/igather.c index c1777b5cec4..55d1ec317c7 100644 --- a/ompi/mpi/c/igather.c +++ b/ompi/mpi/c/igather.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int err; + SPC_RECORD(OMPI_IGATHER, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/init.c b/ompi/mpi/c/init.c index d316fb743d2..66bea74dddd 100644 --- a/ompi/mpi/c/init.c +++ b/ompi/mpi/c/init.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -25,6 +25,7 @@ #include #include "opal/util/show_help.h" +#include "ompi/runtime/ompi_spc.h" #include "ompi/mpi/c/bindings.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" @@ -83,5 +84,7 @@ int MPI_Init(int *argc, char ***argv) OPAL_CR_INIT_LIBRARY(); + SPC_INIT(); + return MPI_SUCCESS; } diff --git a/ompi/mpi/c/init_thread.c b/ompi/mpi/c/init_thread.c index 38c6d7b7a81..a8b42b3e024 100644 --- a/ompi/mpi/c/init_thread.c +++ b/ompi/mpi/c/init_thread.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -26,6 +26,7 @@ #include "ompi_config.h" #include "opal/util/show_help.h" +#include "ompi/runtime/ompi_spc.h" #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" @@ -81,6 +82,8 @@ int MPI_Init_thread(int *argc, char ***argv, int required, OPAL_CR_INIT_LIBRARY(); + SPC_INIT(); + ompi_hook_base_mpi_init_thread_bottom(argc, argv, required, provided); return MPI_SUCCESS; diff --git a/ompi/mpi/c/iprobe.c b/ompi/mpi/c/iprobe.c index f42da3f9b7c..978bbbb79dc 100644 --- a/ompi/mpi/c/iprobe.c +++ b/ompi/mpi/c/iprobe.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/memchecker.h" #include "ompi/request/request.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -42,6 +43,8 @@ int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status { int rc; + SPC_RECORD(OMPI_IPROBE, 1); + MEMCHECKER( memchecker_comm(comm); ); diff --git a/ompi/mpi/c/irecv.c b/ompi/mpi/c/irecv.c index 3e66e365eb1..139f633d591 100644 --- a/ompi/mpi/c/irecv.c +++ b/ompi/mpi/c/irecv.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -37,12 +38,13 @@ static const char FUNC_NAME[] = "MPI_Irecv"; - int MPI_Irecv(void *buf, int count, MPI_Datatype type, int source, int tag, MPI_Comm comm, MPI_Request *request) { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_IRECV, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_comm(comm); diff --git a/ompi/mpi/c/ireduce.c b/ompi/mpi/c/ireduce.c index 4b1d47d7967..9871dc60c1f 100644 --- a/ompi/mpi/c/ireduce.c +++ b/ompi/mpi/c/ireduce.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count, { int err; + SPC_RECORD(OMPI_IREDUCE, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_comm(comm); diff --git a/ompi/mpi/c/ireduce_scatter.c b/ompi/mpi/c/ireduce_scatter.c index 4d700ba11e5..e159a3d31f1 100644 --- a/ompi/mpi/c/ireduce_scatter.c +++ b/ompi/mpi/c/ireduce_scatter.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts { int i, err, size, count; + SPC_RECORD(OMPI_IREDUCE_SCATTER, 1); + MEMCHECKER( int rank; int count; diff --git a/ompi/mpi/c/ireduce_scatter_block.c b/ompi/mpi/c/ireduce_scatter_block.c index 69f008c95d7..4deca3fd53e 100644 --- a/ompi/mpi/c/ireduce_scatter_block.c +++ b/ompi/mpi/c/ireduce_scatter_block.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount, { int err; + SPC_RECORD(OMPI_IREDUCE_SCATTER_BLOCK, 1); + MEMCHECKER( memchecker_comm(comm); memchecker_datatype(datatype); diff --git a/ompi/mpi/c/irsend.c b/ompi/mpi/c/irsend.c index bc4dd10ab02..0de69f6c13d 100644 --- a/ompi/mpi/c/irsend.c +++ b/ompi/mpi/c/irsend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Irsend(const void *buf, int count, MPI_Datatype type, int dest, { int rc; + SPC_RECORD(OMPI_IRSEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/iscan.c b/ompi/mpi/c/iscan.c index 33145e704f2..7fef3a693ac 100644 --- a/ompi/mpi/c/iscan.c +++ b/ompi/mpi/c/iscan.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Iscan(const void *sendbuf, void *recvbuf, int count, { int err; + SPC_RECORD(OMPI_ISCAN, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_comm(comm); diff --git a/ompi/mpi/c/iscatter.c b/ompi/mpi/c/iscatter.c index 683200a0b4e..c5ba1ca41a4 100644 --- a/ompi/mpi/c/iscatter.c +++ b/ompi/mpi/c/iscatter.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Iscatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int err; + SPC_RECORD(OMPI_ISCATTER, 1); + MEMCHECKER( memchecker_comm(comm); if(OMPI_COMM_IS_INTRA(comm)) { diff --git a/ompi/mpi/c/iscatterv.c b/ompi/mpi/c/iscatterv.c index a0ec2eb785f..a571f6e9baa 100644 --- a/ompi/mpi/c/iscatterv.c +++ b/ompi/mpi/c/iscatterv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Iscatterv(const void *sendbuf, const int sendcounts[], const int displs[ { int i, size, err; + SPC_RECORD(OMPI_ISCATTERV, 1); + MEMCHECKER( ptrdiff_t ext; diff --git a/ompi/mpi/c/isend.c b/ompi/mpi/c/isend.c index 5e56deed67e..9335814d35e 100644 --- a/ompi/mpi/c/isend.c +++ b/ompi/mpi/c/isend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -41,12 +42,13 @@ static const char FUNC_NAME[] = "MPI_Isend"; - int MPI_Isend(const void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm, MPI_Request *request) { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_ISEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/issend.c b/ompi/mpi/c/issend.c index ef573087dbb..3e2037c355a 100644 --- a/ompi/mpi/c/issend.c +++ b/ompi/mpi/c/issend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -46,6 +47,8 @@ int MPI_Issend(const void *buf, int count, MPI_Datatype type, int dest, { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_ISSEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/mrecv.c b/ompi/mpi/c/mrecv.c index bf1d6b11e9f..7f1748a1bbe 100644 --- a/ompi/mpi/c/mrecv.c +++ b/ompi/mpi/c/mrecv.c @@ -3,6 +3,9 @@ * Copyright (c) 2012-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,6 +21,7 @@ #include "ompi/memchecker.h" #include "ompi/request/request.h" #include "ompi/message/message.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -35,6 +39,8 @@ int MPI_Mrecv(void *buf, int count, MPI_Datatype type, int rc = MPI_SUCCESS; ompi_communicator_t *comm; + SPC_RECORD(OMPI_MRECV, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_message(message); diff --git a/ompi/mpi/c/neighbor_allgather.c b/ompi/mpi/c/neighbor_allgather.c index 88df4e78c5c..982ed8b440c 100644 --- a/ompi/mpi/c/neighbor_allgather.c +++ b/ompi/mpi/c/neighbor_allgather.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -35,6 +35,7 @@ #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -52,6 +53,8 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send { int err; + SPC_RECORD(OMPI_NEIGHBOR_ALLGATHER, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/neighbor_allgatherv.c b/ompi/mpi/c/neighbor_allgatherv.c index 2c775a9e5bb..4aa82a47d9b 100644 --- a/ompi/mpi/c/neighbor_allgatherv.c +++ b/ompi/mpi/c/neighbor_allgatherv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -36,6 +36,7 @@ #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -53,6 +54,8 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen { int in_size, out_size, err; + SPC_RECORD(OMPI_NEIGHBOR_ALLGATHERV, 1); + MEMCHECKER( int rank; ptrdiff_t ext; diff --git a/ompi/mpi/c/neighbor_alltoall.c b/ompi/mpi/c/neighbor_alltoall.c index 35a39cbcbc2..280ee9d32e6 100644 --- a/ompi/mpi/c/neighbor_alltoall.c +++ b/ompi/mpi/c/neighbor_alltoall.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -34,6 +34,7 @@ #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -52,6 +53,8 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt size_t sendtype_size, recvtype_size; int err; + SPC_RECORD(OMPI_NEIGHBOR_ALLTOALL, 1); + MEMCHECKER( memchecker_comm(comm); if (MPI_IN_PLACE != sendbuf) { diff --git a/ompi/mpi/c/neighbor_alltoallv.c b/ompi/mpi/c/neighbor_alltoallv.c index 5004e6b42d6..77955d05659 100644 --- a/ompi/mpi/c/neighbor_alltoallv.c +++ b/ompi/mpi/c/neighbor_alltoallv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -34,6 +34,7 @@ #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -53,6 +54,8 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in int i, err; int indegree, outdegree; + SPC_RECORD(OMPI_NEIGHBOR_ALLTOALLV, 1); + MEMCHECKER( ptrdiff_t recv_ext; ptrdiff_t send_ext; diff --git a/ompi/mpi/c/neighbor_alltoallw.c b/ompi/mpi/c/neighbor_alltoallw.c index 5d339bfa6d6..6ab8854f8be 100644 --- a/ompi/mpi/c/neighbor_alltoallw.c +++ b/ompi/mpi/c/neighbor_alltoallw.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -34,6 +34,7 @@ #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -53,6 +54,8 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP int i, err; int indegree, outdegree; + SPC_RECORD(OMPI_NEIGHBOR_ALLTOALLW, 1); + MEMCHECKER( ptrdiff_t recv_ext; ptrdiff_t send_ext; diff --git a/ompi/mpi/c/probe.c b/ompi/mpi/c/probe.c index c3ce1e160e2..67977bad1be 100644 --- a/ompi/mpi/c/probe.c +++ b/ompi/mpi/c/probe.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/memchecker.h" #include "ompi/request/request.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -42,6 +43,8 @@ int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status) { int rc; + SPC_RECORD(OMPI_PROBE, 1); + MEMCHECKER( memchecker_comm(comm); ); diff --git a/ompi/mpi/c/put.c b/ompi/mpi/c/put.c index 441b81bb667..675a6f60f49 100644 --- a/ompi/mpi/c/put.c +++ b/ompi/mpi/c/put.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/win/win.h" #include "ompi/mca/osc/osc.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Put(const void *origin_addr, int origin_count, MPI_Datatype origin_datat { int rc; + SPC_RECORD(OMPI_PUT, 1); + if (MPI_PARAM_CHECK) { rc = OMPI_SUCCESS; diff --git a/ompi/mpi/c/recv.c b/ompi/mpi/c/recv.c index 864fdd2cdbb..f92ee3c72a1 100644 --- a/ompi/mpi/c/recv.c +++ b/ompi/mpi/c/recv.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/memchecker.h" #include "ompi/request/request.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -37,12 +38,13 @@ static const char FUNC_NAME[] = "MPI_Recv"; - int MPI_Recv(void *buf, int count, MPI_Datatype type, int source, int tag, MPI_Comm comm, MPI_Status *status) { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_RECV, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isaddressable, buf, count, type); diff --git a/ompi/mpi/c/reduce.c b/ompi/mpi/c/reduce.c index 92cb8024d75..3091aac6518 100644 --- a/ompi/mpi/c/reduce.c +++ b/ompi/mpi/c/reduce.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, { int err; + SPC_RECORD(OMPI_REDUCE, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_comm(comm); diff --git a/ompi/mpi/c/rget.c b/ompi/mpi/c/rget.c index 34c5e9dd5e7..8c45e760fbc 100644 --- a/ompi/mpi/c/rget.c +++ b/ompi/mpi/c/rget.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/win/win.h" #include "ompi/mca/osc/osc.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Rget(void *origin_addr, int origin_count, { int rc; + SPC_RECORD(OMPI_RGET, 1); + if (MPI_PARAM_CHECK) { rc = OMPI_SUCCESS; diff --git a/ompi/mpi/c/rput.c b/ompi/mpi/c/rput.c index 6d66501b2cb..42ac6d8889b 100644 --- a/ompi/mpi/c/rput.c +++ b/ompi/mpi/c/rput.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/win/win.h" #include "ompi/mca/osc/osc.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype origin_data { int rc; + SPC_RECORD(OMPI_RPUT, 1); + if (MPI_PARAM_CHECK) { rc = OMPI_SUCCESS; diff --git a/ompi/mpi/c/rsend.c b/ompi/mpi/c/rsend.c index 5ee5e7f1d38..8f82e035255 100644 --- a/ompi/mpi/c/rsend.c +++ b/ompi/mpi/c/rsend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,7 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/mca/pml/pml.h" #include "ompi/memchecker.h" - +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -46,6 +46,8 @@ int MPI_Rsend(const void *buf, int count, MPI_Datatype type, int dest, int tag, { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_RSEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/scan.c b/ompi/mpi/c/scan.c index 242ccf030ea..e189fe9df26 100644 --- a/ompi/mpi/c/scan.c +++ b/ompi/mpi/c/scan.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -31,6 +31,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Scan(const void *sendbuf, void *recvbuf, int count, { int err; + SPC_RECORD(OMPI_SCAN, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_comm(comm); diff --git a/ompi/mpi/c/scatter.c b/ompi/mpi/c/scatter.c index 91cbf30c3dd..8942224d3cb 100644 --- a/ompi/mpi/c/scatter.c +++ b/ompi/mpi/c/scatter.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -49,6 +50,8 @@ int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, { int err; + SPC_RECORD(OMPI_SCATTER, 1); + MEMCHECKER( memchecker_comm(comm); if(OMPI_COMM_IS_INTRA(comm)) { diff --git a/ompi/mpi/c/scatterv.c b/ompi/mpi/c/scatterv.c index 2cfe3163e27..5ff59e89d32 100644 --- a/ompi/mpi/c/scatterv.c +++ b/ompi/mpi/c/scatterv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -47,6 +48,8 @@ int MPI_Scatterv(const void *sendbuf, const int sendcounts[], const int displs[] { int i, size, err; + SPC_RECORD(OMPI_SCATTERV, 1); + MEMCHECKER( ptrdiff_t ext; diff --git a/ompi/mpi/c/send.c b/ompi/mpi/c/send.c index d5b859aede4..b44ef219aed 100644 --- a/ompi/mpi/c/send.c +++ b/ompi/mpi/c/send.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -40,12 +41,13 @@ static const char FUNC_NAME[] = "MPI_Send"; - int MPI_Send(const void *buf, int count, MPI_Datatype type, int dest, int tag, MPI_Comm comm) { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_SEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/sendrecv.c b/ompi/mpi/c/sendrecv.c index f37d66bc71d..57beaccaa0e 100644 --- a/ompi/mpi/c/sendrecv.c +++ b/ompi/mpi/c/sendrecv.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -29,6 +29,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, ompi_request_t* req; int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_SENDRECV, 1); + MEMCHECKER( memchecker_datatype(sendtype); memchecker_datatype(recvtype); diff --git a/ompi/mpi/c/sendrecv_replace.c b/ompi/mpi/c/sendrecv_replace.c index bb9f4126f13..28167e5f6fe 100644 --- a/ompi/mpi/c/sendrecv_replace.c +++ b/ompi/mpi/c/sendrecv_replace.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2017 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/proc/proc.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -48,6 +49,8 @@ int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype datatype, { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_SENDRECV_REPLACE, 1); + MEMCHECKER( memchecker_datatype(datatype); memchecker_call(&opal_memchecker_base_isdefined, buf, count, datatype); diff --git a/ompi/mpi/c/ssend.c b/ompi/mpi/c/ssend.c index 8f27f054957..b8a35a4ba08 100644 --- a/ompi/mpi/c/ssend.c +++ b/ompi/mpi/c/ssend.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/mca/pml/pml.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -45,6 +46,8 @@ int MPI_Ssend(const void *buf, int count, MPI_Datatype type, int dest, int tag, { int rc = MPI_SUCCESS; + SPC_RECORD(OMPI_SSEND, 1); + MEMCHECKER( memchecker_datatype(type); memchecker_call(&opal_memchecker_base_isdefined, buf, count, type); diff --git a/ompi/mpi/c/test.c b/ompi/mpi/c/test.c index 8e29b3c4cf0..4d241b49287 100644 --- a/ompi/mpi/c/test.c +++ b/ompi/mpi/c/test.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -42,6 +43,8 @@ int MPI_Test(MPI_Request *request, int *completed, MPI_Status *status) { int rc; + SPC_RECORD(OMPI_TEST, 1); + MEMCHECKER( memchecker_request (request); ); diff --git a/ompi/mpi/c/testall.c b/ompi/mpi/c/testall.c index 46528bce49a..e4760d26110 100644 --- a/ompi/mpi/c/testall.c +++ b/ompi/mpi/c/testall.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -44,6 +45,8 @@ static const char FUNC_NAME[] = "MPI_Testall"; int MPI_Testall(int count, MPI_Request requests[], int *flag, MPI_Status statuses[]) { + SPC_RECORD(OMPI_TESTALL, 1); + MEMCHECKER( int j; for (j = 0; j < count; j++){ diff --git a/ompi/mpi/c/testany.c b/ompi/mpi/c/testany.c index cc21513f514..acb0b1a5775 100644 --- a/ompi/mpi/c/testany.c +++ b/ompi/mpi/c/testany.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -43,6 +44,8 @@ static const char FUNC_NAME[] = "MPI_Testany"; int MPI_Testany(int count, MPI_Request requests[], int *indx, int *completed, MPI_Status *status) { + SPC_RECORD(OMPI_TESTANY, 1); + MEMCHECKER( int j; for (j = 0; j < count; j++){ diff --git a/ompi/mpi/c/testsome.c b/ompi/mpi/c/testsome.c index 16bc677b328..e97674503d4 100644 --- a/ompi/mpi/c/testsome.c +++ b/ompi/mpi/c/testsome.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -45,6 +46,8 @@ int MPI_Testsome(int incount, MPI_Request requests[], int *outcount, int indices[], MPI_Status statuses[]) { + SPC_RECORD(OMPI_TESTSOME, 1); + MEMCHECKER( int j; for (j = 0; j < incount; j++){ diff --git a/ompi/mpi/c/wait.c b/ompi/mpi/c/wait.c index c8e8a521b77..1ce8bd19783 100644 --- a/ompi/mpi/c/wait.c +++ b/ompi/mpi/c/wait.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -40,6 +41,8 @@ static const char FUNC_NAME[] = "MPI_Wait"; int MPI_Wait(MPI_Request *request, MPI_Status *status) { + SPC_RECORD(OMPI_WAIT, 1); + MEMCHECKER( memchecker_request(request); ); diff --git a/ompi/mpi/c/waitall.c b/ompi/mpi/c/waitall.c index d70d4684d76..dd9d4317787 100644 --- a/ompi/mpi/c/waitall.c +++ b/ompi/mpi/c/waitall.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -29,6 +29,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -42,6 +43,8 @@ static const char FUNC_NAME[] = "MPI_Waitall"; int MPI_Waitall(int count, MPI_Request requests[], MPI_Status statuses[]) { + SPC_RECORD(OMPI_WAITALL, 1); + MEMCHECKER( int j; for (j = 0; j < count; j++){ diff --git a/ompi/mpi/c/waitany.c b/ompi/mpi/c/waitany.c index ead11415677..aa24433cf45 100644 --- a/ompi/mpi/c/waitany.c +++ b/ompi/mpi/c/waitany.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -43,6 +44,8 @@ static const char FUNC_NAME[] = "MPI_Waitany"; int MPI_Waitany(int count, MPI_Request requests[], int *indx, MPI_Status *status) { + SPC_RECORD(OMPI_WAITANY, 1); + MEMCHECKER( int j; for (j = 0; j < count; j++){ diff --git a/ompi/mpi/c/waitsome.c b/ompi/mpi/c/waitsome.c index 71723da40ad..eeb51f3d5b2 100644 --- a/ompi/mpi/c/waitsome.c +++ b/ompi/mpi/c/waitsome.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/request/request.h" #include "ompi/memchecker.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -45,6 +46,8 @@ int MPI_Waitsome(int incount, MPI_Request requests[], int *outcount, int indices[], MPI_Status statuses[]) { + SPC_RECORD(OMPI_WAITSOME, 1); + MEMCHECKER( int j; for (j = 0; j < incount; j++){ diff --git a/ompi/mpi/c/wtick.c b/ompi/mpi/c/wtick.c index a246288e777..985e70cc0a8 100644 --- a/ompi/mpi/c/wtick.c +++ b/ompi/mpi/c/wtick.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -34,6 +34,7 @@ #include MCA_timer_IMPLEMENTATION_HEADER #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/mpiruntime.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -44,6 +45,8 @@ double MPI_Wtick(void) { + SPC_RECORD(OMPI_WTICK, 1); + OPAL_CR_NOOP_PROGRESS(); /* diff --git a/ompi/mpi/c/wtime.c b/ompi/mpi/c/wtime.c index 2b72d27ba71..ffdd5b95ab5 100644 --- a/ompi/mpi/c/wtime.c +++ b/ompi/mpi/c/wtime.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -34,6 +34,7 @@ #include MCA_timer_IMPLEMENTATION_HEADER #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/mpiruntime.h" +#include "ompi/runtime/ompi_spc.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -46,6 +47,8 @@ double MPI_Wtime(void) { double wtime; + SPC_RECORD(OMPI_WTIME, 1); + /* * See https://github.com/open-mpi/ompi/issues/3003 to find out * what's happening here. diff --git a/ompi/runtime/Makefile.am b/ompi/runtime/Makefile.am index 427abba2674..6d1400eae30 100644 --- a/ompi/runtime/Makefile.am +++ b/ompi/runtime/Makefile.am @@ -2,7 +2,7 @@ # Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University +# Copyright (c) 2004-2018 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -25,9 +25,10 @@ dist_ompidata_DATA += runtime/help-mpi-runtime.txt headers += \ runtime/mpiruntime.h \ - runtime/ompi_cr.h \ + runtime/ompi_cr.h \ runtime/params.h \ - runtime/ompi_info_support.h + runtime/ompi_info_support.h \ + runtime/ompi_spc.h lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ runtime/ompi_mpi_abort.c \ @@ -36,5 +37,6 @@ lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ runtime/ompi_mpi_finalize.c \ runtime/ompi_mpi_params.c \ runtime/ompi_mpi_preconnect.c \ - runtime/ompi_cr.c \ - runtime/ompi_info_support.c + runtime/ompi_cr.c \ + runtime/ompi_info_support.c \ + runtime/ompi_spc.c diff --git a/ompi/runtime/ompi_mpi_params.c b/ompi/runtime/ompi_mpi_params.c index f8376db633d..0604fd3c1bf 100644 --- a/ompi/runtime/ompi_mpi_params.c +++ b/ompi/runtime/ompi_mpi_params.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -75,6 +75,9 @@ bool ompi_async_mpi_finalize = false; uint32_t ompi_add_procs_cutoff = OMPI_ADD_PROCS_CUTOFF_DEFAULT; bool ompi_mpi_dynamics_enabled = true; +char *ompi_mpi_spc_attach_string = NULL; +bool ompi_mpi_spc_dump_enabled = false; + static bool show_default_mca_params = false; static bool show_file_mca_params = false; static bool show_enviro_mca_params = false; @@ -315,6 +318,22 @@ int ompi_mpi_register_params(void) MCA_BASE_VAR_SYN_FLAG_DEPRECATED); } + ompi_mpi_spc_attach_string = NULL; + (void) mca_base_var_register("ompi", "mpi", NULL, "spc_attach", + "A comma delimeted string listing the SPC counters to enable.", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_mpi_spc_attach_string); + + ompi_mpi_spc_dump_enabled = false; + (void) mca_base_var_register("ompi", "mpi", NULL, "spc_dump_enabled", + "A boolean value for whether (true) or not (false) to enable dumping SPC counters in MPI_Finalize.", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_mpi_spc_dump_enabled); + return OMPI_SUCCESS; } diff --git a/ompi/runtime/ompi_spc.c b/ompi/runtime/ompi_spc.c new file mode 100644 index 00000000000..312347e20d5 --- /dev/null +++ b/ompi/runtime/ompi_spc.c @@ -0,0 +1,510 @@ +/* + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_spc.h" + +opal_timer_t sys_clock_freq_mhz = 0; + +/* Array for converting from SPC indices to MPI_T indices */ +OMPI_DECLSPEC int mpi_t_indices[OMPI_NUM_COUNTERS] = {0}; +OMPI_DECLSPEC int mpi_t_offset = -1; +OMPI_DECLSPEC int mpi_t_disabled = 0; + +/* Array of names for each counter. Used for MPI_T and PAPI sde initialization */ +OMPI_DECLSPEC const char *counter_names[OMPI_NUM_COUNTERS] = { + "OMPI_SEND", + "OMPI_BSEND", + "OMPI_RSEND", + "OMPI_SSEND", + "OMPI_RECV", + "OMPI_MRECV", + "OMPI_ISEND", + "OMPI_IBSEND", + "OMPI_IRSEND", + "OMPI_ISSEND", + "OMPI_IRECV", + "OMPI_SENDRECV", + "OMPI_SENDRECV_REPLACE", + "OMPI_PUT", + "OMPI_RPUT", + "OMPI_GET", + "OMPI_RGET", + "OMPI_PROBE", + "OMPI_IPROBE", + "OMPI_BCAST", + "OMPI_IBCAST", + "OMPI_REDUCE", + "OMPI_IREDUCE", + "OMPI_IREDUCE_SCATTER", + "OMPI_IREDUCE_SCATTER_BLOCK", + "OMPI_ALLREDUCE", + "OMPI_IALLREDUCE", + "OMPI_SCAN", + "OMPI_ISCAN", + "OMPI_SCATTER", + "OMPI_SCATTERV", + "OMPI_ISCATTER", + "OMPI_ISCATTERV", + "OMPI_GATHER", + "OMPI_GATHERV", + "OMPI_IGATHER", + "OMPI_ALLTOALL", + "OMPI_IALLTOALL", + "OMPI_IALLTOALLV", + "OMPI_IALLTOALLW", + "OMPI_NEIGHBOR_ALLTOALL", + "OMPI_NEIGHBOR_ALLTOALLV", + "OMPI_NEIGHBOR_ALLTOALLW", + "OMPI_ALLGATHER", + "OMPI_ALLGATHERV", + "OMPI_IALLGATHER", + "OMPI_IALLGATHERV", + "OMPI_NEIGHBOR_ALLGATHER", + "OMPI_NEIGHBOR_ALLGATHERV", + "OMPI_TEST", + "OMPI_TESTALL", + "OMPI_TESTANY", + "OMPI_TESTSOME", + "OMPI_WAIT", + "OMPI_WAITALL", + "OMPI_WAITANY", + "OMPI_WAITSOME", + "OMPI_BARRIER", + "OMPI_IBARRIER", + "OMPI_WTICK", + "OMPI_WTIME", + "OMPI_CANCEL", + "OMPI_BYTES_RECEIVED_USER", + "OMPI_BYTES_RECEIVED_MPI", + "OMPI_BYTES_SENT_USER", + "OMPI_BYTES_SENT_MPI", + "OMPI_BYTES_PUT", + "OMPI_BYTES_GET", + "OMPI_UNEXPECTED", + "OMPI_OUT_OF_SEQUENCE", + "OMPI_MATCH_TIME", + "OMPI_UNEXPECTED_IN_QUEUE", + "OMPI_OOS_IN_QUEUE", + "OMPI_MAX_UNEXPECTED_IN_QUEUE", + "OMPI_MAX_OOS_IN_QUEUE" +}; + +/* Array of descriptions for each counter. Used for MPI_T and PAPI sde initialization */ +OMPI_DECLSPEC const char *counter_descriptions[OMPI_NUM_COUNTERS] = { + "The number of times MPI_Send was called.", + "The number of times MPI_Bsend was called.", + "The number of times MPI_Rsend was called.", + "The number of times MPI_Ssend was called.", + "The number of times MPI_Recv was called.", + "The number of times MPI_Mrecv was called.", + "The number of times MPI_Isend was called.", + "The number of times MPI_Ibsend was called.", + "The number of times MPI_Irsend was called.", + "The number of times MPI_Issend was called.", + "The number of times MPI_Irecv was called.", + "The number of times MPI_Sendrecv was called.", + "The number of times MPI_Sendrecv_replace was called.", + "The number of times MPI_Put was called.", + "The number of times MPI_Rput was called.", + "The number of times MPI_Get was called.", + "The number of times MPI_Rget was called.", + "The number of times MPI_Probe was called.", + "The number of times MPI_Iprobe was called.", + "The number of times MPI_Bcast was called.", + "The number of times MPI_Ibcast was called.", + "The number of times MPI_Reduce was called.", + "The number of times MPI_Ireduce was called.", + "The number of times MPI_Ireduce_scatter was called.", + "The number of times MPI_Ireduce_scatter_block was called.", + "The number of times MPI_Allreduce was called.", + "The number of times MPI_Iallreduce was called.", + "The number of times MPI_Scan was called.", + "The number of times MPI_Iscan was called.", + "The number of times MPI_Scatter was called.", + "The number of times MPI_Scatterv was called.", + "The number of times MPI_Iscatter was called.", + "The number of times MPI_Iscatterv was called.", + "The number of times MPI_Gather was called.", + "The number of times MPI_Gatherv was called.", + "The number of times MPI_Igather was called.", + "The number of times MPI_Alltoall was called.", + "The number of times MPI_Ialltoall was called.", + "The number of times MPI_Ialltoallv was called.", + "The number of times MPI_Ialltoallw was called.", + "The number of times MPI_Neighbor_alltoall was called.", + "The number of times MPI_Neighbor_alltoallv was called.", + "The number of times MPI_Neighbor_alltoallw was called.", + "The number of times MPI_Allgather was called.", + "The number of times MPI_Allgatherv was called.", + "The number of times MPI_Iallgather was called.", + "The number of times MPI_Iallgatherv was called.", + "The number of times MPI_Neighbor_allgather was called.", + "The number of times MPI_Neighbor_allgatherv was called.", + "The number of times MPI_Test was called.", + "The number of times MPI_Testall was called.", + "The number of times MPI_Testany was called.", + "The number of times MPI_Testsome was called.", + "The number of times MPI_Wait was called.", + "The number of times MPI_Waitall was called.", + "The number of times MPI_Waitany was called.", + "The number of times MPI_Waitsome was called.", + "The number of times MPI_Barrier was called.", + "The number of times MPI_Ibarrier was called.", + "The number of times MPI_Wtick was called.", + "The number of times MPI_Wtime was called.", + "The number of times MPI_Cancel was called.", + "The number of bytes received by the user through point-to-point communications. Note: Includes bytes transferred using internal RMA operations.", + "The number of bytes received by MPI through collective, control, or other internal communications.", + "The number of bytes sent by the user through point-to-point communications. Note: Includes bytes transferred using internal RMA operations.", + "The number of bytes sent by MPI through collective, control, or other internal communications.", + "The number of bytes sent/received using RMA Put operations both through user-level Put functions and internal Put functions.", + "The number of bytes sent/received using RMA Get operations both through user-level Get functions and internal Get functions.", + "The number of messages that arrived as unexpected messages.", + "The number of messages that arrived out of the proper sequence.", + "The number of microseconds spent matching unexpected messages.", + "The number of messages that are currently in the unexpected message queue(s) of an MPI process.", + "The number of messages that are currently in the out of sequence message queue(s) of an MPI process.", + "The maximum number of messages that the unexpected message queue(s) within an MPI process contained at once since the last reset of this counter. \ +Note: This counter is reset each time it is read.", + "The maximum number of messages that the out of sequence message queue(s) within an MPI process contained at once since the last reset of this counter. \ +Note: This counter is reset each time it is read." +}; + +/* An array of integer values to denote whether an event is activated (1) or not (0) */ +OMPI_DECLSPEC unsigned int attached_event[OMPI_NUM_COUNTERS] = { 0 }; +/* An array of integer values to denote whether an event is timer-based (1) or not (0) */ +OMPI_DECLSPEC unsigned int timer_event[OMPI_NUM_COUNTERS] = { 0 }; +/* An array of event structures to store the event data (name and value) */ +OMPI_DECLSPEC ompi_event_t *events = NULL; + +/* ############################################################## + * ################# Begin MPI_T Functions ###################### + * ############################################################## + */ +static int ompi_spc_notify(mca_base_pvar_t *pvar, mca_base_pvar_event_t event, void *obj_handle, int *count) +{ + (void)obj_handle; + + int index; + + if(OPAL_UNLIKELY(mpi_t_disabled == 1)) + return MPI_SUCCESS; + + /* For this event, we need to set count to the number of long long type + * values for this counter. All SPC counters are one long long, so we + * always set count to 1. + */ + if(MCA_BASE_PVAR_HANDLE_BIND == event) { + *count = 1; + } + /* For this event, we need to turn on the counter */ + else if(MCA_BASE_PVAR_HANDLE_START == event) { + /* Convert from MPI_T pvar index to SPC index */ + index = pvar->pvar_index - mpi_t_offset; + attached_event[index] = 1; + } + /* For this event, we need to turn off the counter */ + else if(MCA_BASE_PVAR_HANDLE_STOP == event) { + /* Convert from MPI_T pvar index to SPC index */ + index = pvar->pvar_index - mpi_t_offset; + attached_event[index] = 0; + } + + return MPI_SUCCESS; +} + +/* ############################################################## + * ################# Begin SPC Functions ######################## + * ############################################################## + */ + +/* This function returns the current count of an SPC counter that has been retistered + * as an MPI_T pvar. The MPI_T index is not necessarily the same as the SPC index, + * so we need to convert from MPI_T index to SPC index and then set the 'value' argument + * to the correct value for this pvar. + */ +static int ompi_spc_get_count(const struct mca_base_pvar_t *pvar, void *value, void *obj_handle) +{ + (void) obj_handle; + + long long *counter_value = (long long*)value; + + if(OPAL_UNLIKELY(mpi_t_disabled == 1)) { + *counter_value = 0; + return MPI_SUCCESS; + } + + /* Convert from MPI_T pvar index to SPC index */ + int index = pvar->pvar_index - mpi_t_offset; + /* Set the counter value to the current SPC value */ + *counter_value = events[index].value; + /* If this is a timer-based counter, convert from cycles to microseconds */ + if(timer_event[index]) + *counter_value /= sys_clock_freq_mhz; + /* If this is a high watermark counter, reset it after it has been read */ + if(index == OMPI_MAX_UNEXPECTED_IN_QUEUE || index == OMPI_MAX_OOS_IN_QUEUE) + events[index].value = 0; + + return MPI_SUCCESS; +} + +/* Initializes the events data structure and allocates memory for it if needed. */ +void events_init() +{ + int i; + + /* If the events data structure hasn't been allocated yet, allocate memory for it */ + if(events == NULL) { + events = (ompi_event_t*)malloc(OMPI_NUM_COUNTERS * sizeof(ompi_event_t)); + } + /* The data structure has been allocated, so we simply initialize all of the counters + * with their names and an initial count of 0. + */ + for(i = 0; i < OMPI_NUM_COUNTERS; i++) { + events[i].name = counter_names[i]; + events[i].value = 0; + } +} + +/* Initializes the SPC data structures and registers all counters as MPI_T pvars. + * Turns on only the counters that were specified in the mpi_spc_attach MCA parameter. + */ +void ompi_spc_init() +{ + int i, j, ret, found = 0, all_on = 0; + + /* Initialize the clock frequency variable as the CPU's frequency in MHz */ + sys_clock_freq_mhz = opal_timer_base_get_freq() / 1000000; + + events_init(); + + /* Get the MCA params string of counters to turn on */ + char **arg_strings = opal_argv_split(ompi_mpi_spc_attach_string, ','); + int num_args = opal_argv_count(arg_strings); + + /* If there is only one argument and it is 'all', then all counters + * should be turned on. If the size is 0, then no counters will be enabled. + */ + if(num_args == 1) { + if(strcmp(arg_strings[0], "all") == 0) + all_on = 1; + } + + int prev = -1; + /* Turn on only the counters that were specified in the MCA parameter */ + for(i = 0; i < OMPI_NUM_COUNTERS; i++) { + if(all_on) + attached_event[i] = 1; + else { + /* Note: If no arguments were given, this will be skipped */ + for(j = 0; j < num_args && found < num_args; j++) { + if(strcmp(counter_names[i], arg_strings[j]) == 0) { + attached_event[i] = 1; + found++; + } + } + } + + /* ######################################################################## + * ################## Add Timer-Based Counter Enums Here ################## + * ######################################################################## + */ + /* If this is a timer event, sent the corresponding timer_event entry to 1 */ + if(i == OMPI_MATCH_TIME) + timer_event[i] = 1; + else + timer_event[i] = 0; + + /* Registers the current counter as an MPI_T pvar regardless of whether it's been turned on or not */ + ret = mca_base_pvar_register("ompi", "runtime", "spc", counter_names[i], counter_descriptions[i], + OPAL_INFO_LVL_4, MPI_T_PVAR_CLASS_SIZE, + MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, NULL, MPI_T_BIND_NO_OBJECT, + MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, + ompi_spc_get_count, NULL, ompi_spc_notify, NULL); + + /* Initialize the mpi_t_indices array with the MPI_T indices. + * The array index indicates the SPC index, while the value indicates + * the MPI_T index. + */ + if(ret != OPAL_ERROR) { + mpi_t_indices[i] = ret; + + if(mpi_t_offset == -1) { + mpi_t_offset = ret; + prev = ret; + } else if(ret != prev + 1) { + mpi_t_disabled = 1; + fprintf(stderr, "There was an error registering SPCs as MPI_T pvars. SPCs will be disabled for MPI_T.\n"); + break; + } else { + prev = ret; + } + } else { + mpi_t_indices[i] = -1; + mpi_t_disabled = 1; + fprintf(stderr, "There was an error registering SPCs as MPI_T pvars. SPCs will be disabled for MPI_T.\n"); + break; + } + } +} + +/* Frees any dynamically alocated OMPI SPC data structures */ +void ompi_spc_fini() +{ +#if SPC_ENABLE == 1 + if(!ompi_mpi_spc_dump_enabled) + goto skip_dump; + + int i, j, rank, world_size, offset, err; + long long *recv_buffer, *send_buffer; + + ompi_communicator_t *comm = &ompi_mpi_comm_world.comm; + + rank = ompi_comm_rank(comm); + world_size = ompi_comm_size(comm); + + /* Convert from cycles to usecs before sending */ + for(i = 0; i < OMPI_NUM_COUNTERS; i++) { + if(timer_event[i]) + SPC_CYCLES_TO_USECS(&events[i].value); + } + + /* Aggregate all of the information on rank 0 using MPI_Gather on MPI_COMM_WORLD */ + if(rank == 0) { + send_buffer = (long long*)malloc(OMPI_NUM_COUNTERS * sizeof(long long)); + recv_buffer = (long long*)malloc(world_size * OMPI_NUM_COUNTERS * sizeof(long long)); + for(i = 0; i < OMPI_NUM_COUNTERS; i++) { + send_buffer[i] = events[i].value; + } + err = comm->c_coll->coll_gather(send_buffer, OMPI_NUM_COUNTERS, MPI_LONG_LONG, + recv_buffer, OMPI_NUM_COUNTERS, MPI_LONG_LONG, + 0, comm, + comm->c_coll->coll_gather_module); + } else { + send_buffer = (long long*)malloc(OMPI_NUM_COUNTERS * sizeof(long long)); + for(i = 0; i < OMPI_NUM_COUNTERS; i++) { + send_buffer[i] = events[i].value; + } + err = comm->c_coll->coll_gather(send_buffer, OMPI_NUM_COUNTERS, MPI_LONG_LONG, + recv_buffer, OMPI_NUM_COUNTERS, MPI_LONG_LONG, + 0, comm, + comm->c_coll->coll_gather_module); + } + + /* Once rank 0 has all of the information, print the aggregated counter values for each rank in order */ + if(rank == 0) { + fprintf(stdout, "OMPI Software Counters:\n"); + offset = 0; /* Offset into the recv_buffer for each rank */ + for(j = 0; j < world_size; j++) { + fprintf(stdout, "World Rank %d:\n", j); + for(i = 0; i < OMPI_NUM_COUNTERS; i++) { + if(attached_event[i]) { + /* If this is a timer-based counter, we need to covert from cycles to usecs */ + if(recv_buffer[offset+i] == 0) + continue; + fprintf(stdout, "%s -> %lld\n", events[i].name, recv_buffer[offset+i]); + } + } + fprintf(stdout, "\n"); + offset += OMPI_NUM_COUNTERS; + } + printf("###########################################################################\n"); + printf("NOTE: Any counters not shown here were either disabled or had a value of 0.\n"); + printf("###########################################################################\n"); + + free(recv_buffer); + free(send_buffer); + } else { + free(send_buffer); + } + + comm->c_coll->coll_barrier(comm, comm->c_coll->coll_barrier_module); + skip_dump: + if(rank == 0) + free(events); +#else + int rank = ompi_comm_rank(&ompi_mpi_comm_world.comm); + if(rank == 0) + free(events); +#endif +} + +/* Records an update to a counter using an atomic add operation. */ +void ompi_spc_record(unsigned int event_id, long long value) +{ + /* Denoted unlikely because counters will often be turned off. */ + if(OPAL_UNLIKELY(attached_event[event_id] == 1)) { + OPAL_THREAD_ADD_FETCH_SIZE_T(&(events[event_id].value), value); + } +} + +/* Starts cycle-precision timer and stores the start value in the 'cycles' argument. + * Note: This assumes that the 'cycles' argument is initialized to 0 if the timer + * hasn't been started yet. + */ +void ompi_spc_timer_start(unsigned int event_id, opal_timer_t *cycles) +{ + /* Check whether cycles == 0.0 to make sure the timer hasn't started yet. + * This is denoted unlikely because the counters will often be turned off. + */ + if(OPAL_UNLIKELY(attached_event[event_id] == 1 && *cycles == 0)) { + *cycles = opal_timer_base_get_cycles(); + } +} + +/* Stops a cycle-precision timer and calculates the total elapsed time + * based on the starting time in 'cycles' and stores the result in the + * 'cycles' argument. + */ +void ompi_spc_timer_stop(unsigned int event_id, opal_timer_t *cycles) +{ + /* This is denoted unlikely because the counters will often be turned off. */ + if(OPAL_UNLIKELY(attached_event[event_id] == 1)) { + *cycles = opal_timer_base_get_cycles() - *cycles; + OPAL_THREAD_ADD_FETCH_SIZE_T(&events[event_id].value, (long long)*cycles); + } +} + +/* Checks a tag, and records the user version of the counter if it's greater + * than or equal to 0 and records the mpi version of the counter otherwise. + */ +void ompi_spc_user_or_mpi(int tag, long long value, unsigned int user_enum, unsigned int mpi_enum) +{ + if(tag >= 0) { + SPC_RECORD(user_enum, value); + } else { + SPC_RECORD(mpi_enum, value); + } +} + +/* Checks whether the counter denoted by value_enum exceeds the current value of the + * counter denoted by watermark_enum, and if so sets the watermark_enum counter to the + * value of the value_enum counter. + */ +void ompi_spc_update_watermark(unsigned int watermark_enum, unsigned int value_enum) +{ + /* Denoted unlikely because counters will often be turned off. */ + if(OPAL_UNLIKELY(attached_event[watermark_enum] == 1 && attached_event[value_enum] == 1)) { + /* WARNING: This assumes that this function was called while a lock has already been taken. + * This function is NOT thread safe otherwise! + */ + if(events[value_enum].value > events[watermark_enum].value) + events[watermark_enum].value = events[value_enum].value; + } +} + +/* Converts a counter value that is in cycles to microseconds. + */ +void ompi_spc_cycles_to_usecs(long long *cycles) +{ + *cycles = *cycles / sys_clock_freq_mhz; +} diff --git a/ompi/runtime/ompi_spc.h b/ompi/runtime/ompi_spc.h new file mode 100644 index 00000000000..a3edad5e743 --- /dev/null +++ b/ompi/runtime/ompi_spc.h @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef OMPI_SPC +#define OMPI_SPC + +#include +#include +#include +#include + +#include "ompi/communicator/communicator.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/runtime/params.h" +#include "opal/mca/timer/timer.h" +#include "opal/mca/base/mca_base_pvar.h" +#include "opal/util/argv.h" + +#include MCA_timer_IMPLEMENTATION_HEADER + +/* INSTRUCTIONS FOR ADDING COUNTERS + * 1.) Add a new counter name in the OMPI_COUNTERS enum before + * OMPI_NUM_COUNTERS below. + * 2.) Add corresponding counter name and descriptions to the + * counter_names and counter_descriptions arrays in + * ompi_spc.c NOTE: The names and descriptions + * MUST be in the same array location as where you added the + * counter name in step 1. + * 3.) If this counter is based on a timer, add its enum name to + * the logic for timer-based counters in the ompi_spc_init + * function in ompi_spc.c + * 4.) Instrument the Open MPI code base where it makes sense for + * your counter to be modified using the SPC_RECORD macro. + * Note: If your counter is timer-based you should use the + * SPC_TIMER_START and SPC_TIMER_STOP macros to record + * the time in cycles to then be converted to microseconds later + * in the ompi_spc_get_count function when requested by MPI_T + */ + +/* This enumeration serves as event ids for the various events */ +enum OMPI_COUNTERS{ + OMPI_SEND, + OMPI_BSEND, + OMPI_RSEND, + OMPI_SSEND, + OMPI_RECV, + OMPI_MRECV, + OMPI_ISEND, + OMPI_IBSEND, + OMPI_IRSEND, + OMPI_ISSEND, + OMPI_IRECV, + OMPI_SENDRECV, + OMPI_SENDRECV_REPLACE, + OMPI_PUT, + OMPI_RPUT, + OMPI_GET, + OMPI_RGET, + OMPI_PROBE, + OMPI_IPROBE, + OMPI_BCAST, + OMPI_IBCAST, + OMPI_REDUCE, + OMPI_IREDUCE, + OMPI_IREDUCE_SCATTER, + OMPI_IREDUCE_SCATTER_BLOCK, + OMPI_ALLREDUCE, + OMPI_IALLREDUCE, + OMPI_SCAN, + OMPI_ISCAN, + OMPI_SCATTER, + OMPI_SCATTERV, + OMPI_ISCATTER, + OMPI_ISCATTERV, + OMPI_GATHER, + OMPI_GATHERV, + OMPI_IGATHER, + OMPI_ALLTOALL, + OMPI_IALLTOALL, + OMPI_IALLTOALLV, + OMPI_IALLTOALLW, + OMPI_NEIGHBOR_ALLTOALL, + OMPI_NEIGHBOR_ALLTOALLV, + OMPI_NEIGHBOR_ALLTOALLW, + OMPI_ALLGATHER, + OMPI_ALLGATHERV, + OMPI_IALLGATHER, + OMPI_IALLGATHERV, + OMPI_NEIGHBOR_ALLGATHER, + OMPI_NEIGHBOR_ALLGATHERV, + OMPI_TEST, + OMPI_TESTALL, + OMPI_TESTANY, + OMPI_TESTSOME, + OMPI_WAIT, + OMPI_WAITALL, + OMPI_WAITANY, + OMPI_WAITSOME, + OMPI_BARRIER, + OMPI_IBARRIER, + OMPI_WTICK, + OMPI_WTIME, + OMPI_CANCEL, + OMPI_BYTES_RECEIVED_USER, + OMPI_BYTES_RECEIVED_MPI, + OMPI_BYTES_SENT_USER, + OMPI_BYTES_SENT_MPI, + OMPI_BYTES_PUT, + OMPI_BYTES_GET, + OMPI_UNEXPECTED, + OMPI_OUT_OF_SEQUENCE, + OMPI_MATCH_TIME, + OMPI_UNEXPECTED_IN_QUEUE, + OMPI_OOS_IN_QUEUE, + OMPI_MAX_UNEXPECTED_IN_QUEUE, + OMPI_MAX_OOS_IN_QUEUE, + OMPI_NUM_COUNTERS /* This serves as the number of counters. It must be last. */ +}; + +/* A structure for storing the event data */ +typedef struct ompi_event_s{ + char *name; + long long value; +} ompi_event_t; + +OMPI_DECLSPEC extern unsigned int attached_event[OMPI_NUM_COUNTERS]; +OMPI_DECLSPEC extern unsigned int timer_event[OMPI_NUM_COUNTERS]; +OMPI_DECLSPEC extern ompi_event_t *events; + +/* Events data structure initialization function */ +void events_init(void); + +/* OMPI SPC utility functions */ +void ompi_spc_init(void); +void ompi_spc_fini(void); +void ompi_spc_record(unsigned int event_id, long long value); +void ompi_spc_timer_start(unsigned int event_id, opal_timer_t *cycles); +void ompi_spc_timer_stop(unsigned int event_id, opal_timer_t *cycles); +void ompi_spc_user_or_mpi(int tag, long long value, unsigned int user_enum, unsigned int mpi_enum); +void ompi_spc_cycles_to_usecs(long long *cycles); +void ompi_spc_update_watermark(unsigned int watermark_enum, unsigned int value_enum); + +/* MPI_T utility functions */ +static int ompi_spc_notify(mca_base_pvar_t *pvar, mca_base_pvar_event_t event, void *obj_handle, int *count); +long long ompi_spc_get_counter(int counter_id); + +/* Macros for using the SPC utility functions throughout the codebase. + * If SPC_ENABLE is not 1, the macros become no-ops. + */ +#if SPC_ENABLE == 1 + +#define SPC_INIT() \ + ompi_spc_init() + +#define SPC_FINI() \ + ompi_spc_fini() + +#define SPC_RECORD(event_id, value) \ + ompi_spc_record(event_id, value) + +#define SPC_TIMER_START(event_id, usec) \ + ompi_spc_timer_start(event_id, usec) + +#define SPC_TIMER_STOP(event_id, usec) \ + ompi_spc_timer_stop(event_id, usec) + +#define SPC_USER_OR_MPI(tag, value, enum_if_user, enum_if_mpi) \ + ompi_spc_user_or_mpi(tag, value, enum_if_user, enum_if_mpi) + +#define SPC_CYCLES_TO_USECS(cycles) \ + ompi_spc_cycles_to_usecs(cycles) + +#define SPC_UPDATE_WATERMARK(watermark_enum, value_enum) \ + ompi_spc_update_watermark(watermark_enum, value_enum) + +#else /* SPCs are not enabled */ + +#define SPC_INIT() \ + do {} while (0) + +#define SPC_FINI() \ + do {} while (0) + +#define SPC_RECORD(event_id, value) \ + do {} while (0) + +#define SPC_TIMER_START(event_id, usec) \ + do {} while (0) + +#define SPC_TIMER_STOP(event_id, usec) \ + do {} while (0) + +#define SPC_USER_OR_MPI(tag, value, enum_if_user, enum_if_mpi) \ + do {} while (0) + +#define SPC_CYCLES_TO_USECS(cycles) \ + do {} while (0) + +#define SPC_UPDATE_WATERMARK(watermark_enum, value_enum) \ + do {} while (0) + +#endif + +#endif diff --git a/ompi/runtime/params.h b/ompi/runtime/params.h index 5716e142523..194ac060da1 100644 --- a/ompi/runtime/params.h +++ b/ompi/runtime/params.h @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -141,6 +141,19 @@ OMPI_DECLSPEC extern bool ompi_async_mpi_init; /* EXPERIMENTAL: do not perform an RTE barrier at the beginning of MPI_Finalize */ OMPI_DECLSPEC extern bool ompi_async_mpi_finalize; +/** + * A comma delimited list of SPC counters to turn on or 'attach'. To turn + * all counters on, the string can be simply "all". An empty string will + * keep all counters turned off. + */ +OMPI_DECLSPEC extern char * ompi_mpi_spc_attach_string; + +/** + * A boolean value that determines whether or not to dump the SPC counter + * values in MPI_Finalize. A value of true dumps the counters and false does not. + */ +OMPI_DECLSPEC extern bool ompi_mpi_spc_dump_enabled; + /** * Register MCA parameters used by the MPI layer. diff --git a/opal/mca/base/mca_base_pvar.h b/opal/mca/base/mca_base_pvar.h index 44f23b3dfc1..03ff53b98f8 100644 --- a/opal/mca/base/mca_base_pvar.h +++ b/opal/mca/base/mca_base_pvar.h @@ -2,6 +2,9 @@ /* * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * * Additional copyrights may follow * @@ -319,7 +322,7 @@ OPAL_DECLSPEC int mca_base_pvar_register (const char *project, const char *frame * associated with a component. * * While quite similar to mca_base_pvar_register(), there is one key - * difference: pvars registered this this function will automatically + * difference: pvars registered with this function will automatically * be unregistered / made unavailable when that component is closed by * its framework. */ diff --git a/test/Makefile.am b/test/Makefile.am index 4ed25254849..dff34e825f8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,7 @@ # Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. -# Copyright (c) 2004-2015 The University of Tennessee and The University +# Copyright (c) 2004-2018 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2004-2009 High Performance Computing Center Stuttgart, @@ -24,6 +24,6 @@ # support needs to be first for dependencies SUBDIRS = support asm class threads datatype util dss if PROJECT_OMPI -SUBDIRS += monitoring +SUBDIRS += monitoring spc endif DIST_SUBDIRS = event $(SUBDIRS) diff --git a/test/spc/Makefile.am b/test/spc/Makefile.am new file mode 100644 index 00000000000..3d060b9d418 --- /dev/null +++ b/test/spc/Makefile.am @@ -0,0 +1,24 @@ +# +# Copyright (c) 2018 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This test requires multiple processes to run. Don't run it as part +# of 'make check' +if PROJECT_OMPI + noinst_PROGRAMS = spc_test + spc_test_SOURCES = spc_test.c + spc_test_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) + spc_test_LDADD = \ + $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la +endif # PROJECT_OMPI + +distclean: + rm -rf *.dSYM .deps .libs *.la *.lo spc_test prof *.log *.o *.trs Makefile diff --git a/test/spc/spc_test.c b/test/spc/spc_test.c new file mode 100644 index 00000000000..081b42a8c42 --- /dev/null +++ b/test/spc/spc_test.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * + * Simple example usage of SPCs through MPI_T. + */ + +#include "mpi.h" +#include +#include +#include + +#define MAX_SIZE 1000000 + +/* Sends 'num_messages' messages of 'message_size' bytes from rank 0 to rank 1. + * All messages are sent synchronously and with the same tag in MPI_COMM_WORLD. + */ +void message_exchange(int num_messages, int message_size) +{ + int i, rank; + /* Use calloc to initialize data to 0's */ + char *data = (char*)calloc(message_size, sizeof(char)); + MPI_Status status; + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + if(rank == 0) { + for(i = 0; i < num_messages; i++) + MPI_Send(data, message_size, MPI_BYTE, 1, 123, MPI_COMM_WORLD); + } else if(rank == 1) { + for(i = 0; i < num_messages; i++) + MPI_Recv(data, message_size, MPI_BYTE, 0, 123, MPI_COMM_WORLD, &status); + } + + free(data); +} + +int main(int argc, char **argv) +{ + int i, rank, size, provided, num, name_len, desc_len, verbosity, bind, var_class, readonly, continuous, atomic, count, index, MPI_result; + MPI_Datatype datatype; + MPI_T_enum enumtype; + MPI_Comm comm; + char name[256], description[256]; + + /* Counter names to be read by ranks 0 and 1 */ + char counter_names[2][40]; + sprintf(counter_names[0], "runtime_spc_OMPI_BYTES_SENT_USER"); + sprintf(counter_names[1], "runtime_spc_OMPI_BYTES_RECEIVED_USER"); + + MPI_Init(NULL, NULL); + MPI_result = MPI_T_init_thread(MPI_THREAD_SINGLE, &provided); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to initialize MPI_T thread.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + if(size != 2) { + fprintf(stderr, "ERROR: This test should be run with two MPI processes.\n"); + return -1; + } + + /* Determine the MPI_T pvar indices for the OMPI_BYTES_SENT/RECIEVED_USER SPCs */ + index = -1; + MPI_result = MPI_T_pvar_get_num(&num); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to get the number of pvars.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + for(i = 0; i < num; i++) { + name_len = desc_len = 256; + MPI_T_pvar_get_info(i, name, &name_len, &verbosity, + &var_class, &datatype, &enumtype, description, &desc_len, &bind, + &readonly, &continuous, &atomic); + if(MPI_result != MPI_SUCCESS || MPI_result == MPI_T_ERR_PVAR_NO_STARTSTOP) { + fprintf(stderr, "Failed to get pvar info.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + if(strcmp(name, counter_names[rank]) == 0) { + index = i; + printf("[%d] %s -> %s\n", rank, name, description); + } + } + + /* Make sure we found the counters */ + if(index == -1) { + fprintf(stderr, "ERROR: Couldn't find the appropriate SPC counter in the MPI_T pvars.\n"); + return -1; + } + + long long value; + + MPI_T_pvar_session session; + MPI_T_pvar_handle handle; + /* Create the MPI_T sessions/handles for the counters and start the counters */ + MPI_result = MPI_T_pvar_session_create(&session); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to create MPI_T pvar session.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + MPI_result = MPI_T_pvar_handle_alloc(session, index, NULL, &handle, &count); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to allocate the pvar handle.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + MPI_result = MPI_T_pvar_start(session, handle); + if(MPI_result != MPI_SUCCESS) { + if(MPI_result != MPI_T_ERR_PVAR_NO_STARTSTOP) { + fprintf(stderr, "Failed to start the pvar session.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + } + + int message_size = 1, expected_bytes = 0; + while(message_size <= MAX_SIZE) { + expected_bytes += message_size; + message_exchange(1, message_size); + message_size *= 10; + } + + MPI_result = MPI_T_pvar_read(session, handle, &value); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to read the pvar.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + /* Print the counter values in order by rank */ + for(i = 0; i < 2; i++) { + if(i == rank) { + printf("[%d] Value Read: %lld\n", rank, value); + fflush(stdout); + if(value != expected_bytes){ + fprintf(stderr, "The counter value is inaccurate! It is '%d'. It should be '%d'\n", value, expected_bytes); + MPI_Abort(MPI_COMM_WORLD, MPI_ERR_OTHER); + } + } + MPI_Barrier(MPI_COMM_WORLD); + } + /* Stop the MPI_T session, free the handle, and then free the session */ + MPI_result = MPI_T_pvar_stop(session, handle); + if(MPI_result != MPI_SUCCESS) { + if(MPI_result != MPI_T_ERR_PVAR_NO_STARTSTOP) { + fprintf(stderr, "Failed to stop the pvar session.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + } + + MPI_result = MPI_T_pvar_handle_free(session, &handle); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to free the pvar handle.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + MPI_result = MPI_T_pvar_session_free(&session); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to free the pvar session.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + MPI_result = MPI_T_finalize(); + if(MPI_result != MPI_SUCCESS) { + fprintf(stderr, "Failed to finalize MPI_T.\n"); + MPI_Abort(MPI_COMM_WORLD, MPI_result); + } + + MPI_Finalize(); + + return EXIT_SUCCESS; +}