/* The first receive will block waiting for the last send, since messages from
 * a given rank are received in order. */
void reversed_tags_test()
{
    size_t unexpected_recvq_buffer_size;

    if (rank == 0) {
        int send_buf[EAGER_SIZE] = { 0x1234 };

        MPI_Send(send_buf, EAGER_SIZE, MPI_INT, 1, 0xA, MPI_COMM_WORLD);
        MPI_Send(send_buf, EAGER_SIZE, MPI_INT, 1, 0xB, MPI_COMM_WORLD);
        MPI_Send(send_buf, EAGER_SIZE, MPI_INT, 1, 0xC, MPI_COMM_WORLD);
        MPI_Send(send_buf, EAGER_SIZE, MPI_INT, 1, 0xD, MPI_COMM_WORLD);
    } else if (rank == 1) {
        int recv_buf[EAGER_SIZE];
        MPI_Status status;

        MPI_Recv(recv_buf, EAGER_SIZE, MPI_INT, 0, 0xD, MPI_COMM_WORLD, &status);
        TRY(MPI_T_pvar_read(session, uqsize_handle, &unexpected_recvq_buffer_size));
        assert(unexpected_recvq_buffer_size == 3*EAGER_SIZE*sizeof(int));

        MPI_Recv(recv_buf, EAGER_SIZE, MPI_INT, 0, 0xC, MPI_COMM_WORLD, &status);
        TRY(MPI_T_pvar_read(session, uqsize_handle, &unexpected_recvq_buffer_size));
        assert(unexpected_recvq_buffer_size == 2*EAGER_SIZE*sizeof(int));

        MPI_Recv(recv_buf, EAGER_SIZE, MPI_INT, 0, 0xB, MPI_COMM_WORLD, &status);
        TRY(MPI_T_pvar_read(session, uqsize_handle, &unexpected_recvq_buffer_size));
        assert(unexpected_recvq_buffer_size == 1*EAGER_SIZE*sizeof(int));

        MPI_Recv(recv_buf, EAGER_SIZE, MPI_INT, 0, 0xA, MPI_COMM_WORLD, &status);
        TRY(MPI_T_pvar_read(session, uqsize_handle, &unexpected_recvq_buffer_size));
        assert(unexpected_recvq_buffer_size == 0*EAGER_SIZE*sizeof(int));
    }

    MPI_Barrier(MPI_COMM_WORLD);  /* make sure this test is over before going to the next one */
}
Ejemplo n.º 2
0
static void print_vars(int idx)
{
    MPI_T_pvar_read(session, pq_handle, &posted_qlen);
    MPI_T_pvar_read(session, uq_handle, &unexpected_qlen);
    MPI_T_pvar_read(session, pqm_handle, &posted_queue_match_attempts);
    MPI_T_pvar_read(session, uqm_handle, &unexpected_queue_match_attempts);

    printf("(%d) posted_qlen=%d unexpected_qlen=%d ", idx, posted_qlen, unexpected_qlen);
    printf("posted_queue_match_attempts=%lu unexpected_queue_match_attempts=%lu\n",
           posted_queue_match_attempts, unexpected_queue_match_attempts);
}
Ejemplo n.º 3
0
void print_variable(
		MPI_T_pvar_session sess,
		MPI_T_pvar_handle handle2,
		char *name,
		MPI_Datatype datatype,
		int count,
		unsigned long long int **value_buffer){
	int j;
	void *readbuf = NULL;

	if(datatype == MPI_INT){
		readbuf = (void*)malloc(sizeof(int) * (count + 1));
		MPI_T_pvar_read( sess, handle2, readbuf);
		for(j = 0; j < count; j++)
			printf("(I) %s: %d\n", name, ((int*)readbuf)[j]);
	}
	else if(datatype == MPI_UNSIGNED){
		readbuf = (void*)malloc(sizeof(unsigned int) * (count + 1));
		MPI_T_pvar_read( sess, handle2, readbuf);
		for(j = 0; j < count; j++)
			printf("(UI) %s: %u\n", name, ((unsigned int*)readbuf)[j]);
	}
	else if(datatype == MPI_UNSIGNED_LONG){
		readbuf = (void*)malloc(sizeof(unsigned long) * (count + 1));
		MPI_T_pvar_read( sess, handle2, readbuf);
		for(j = 0; j < count; j++)
			printf("(UL) %s: %lu\n", name, ((unsigned long*)readbuf)[j]);
	}
	else if(datatype == MPI_UNSIGNED_LONG_LONG){
		readbuf = (void*)malloc(sizeof(unsigned long long) * (count + 1));
		MPI_T_pvar_read( sess, handle2, readbuf);
		for(j = 0; j < count; j++)
			printf("(ULL) %s: %llu\n", name, ((unsigned long long*)readbuf)[j]);
	}
	else if(datatype == MPI_CHAR){
		readbuf = (void*)malloc(sizeof(char) * (count + 1));
		MPI_T_pvar_read( sess, handle2, readbuf);
		for(j = 0; j < count; j++)
			printf("(C) %s: %c\n", name, ((char*)readbuf)[j]);
	}
	else if(datatype == MPI_DOUBLE){
		readbuf = (void*)malloc(sizeof(double) * (count + 1));
		MPI_T_pvar_read( sess, handle2, readbuf);
		for(j = 0; j < count; j++)
			printf("(D) %s: %lf\n", name, ((double*)readbuf)[j]);
	}
	else if(datatype == MPI_COUNT){
		readbuf = (void*)malloc(sizeof(MPI_Count) * (count + 1));
		MPI_T_pvar_read( sess, handle2, readbuf);
		for(j = 0; j < count; j++)
			printf("(MPI_Count) %s: %llu\n", name, ((MPI_Count*)readbuf)[j]);
	}
	else{
		printf("<ERROR> UNKNOWN DATATYPE: %s\n", name);
	}
	if(readbuf != NULL)
		free(readbuf);
}
Ejemplo n.º 4
0
void get_monitoring_result(monitoring_result * res)
{
    int MPIT_result;

    MPIT_result = MPI_T_pvar_read(session, res->pvar_handle, res->vector);
    if (MPIT_result != MPI_SUCCESS) {
        fprintf(stderr, "ERROR : failed to read \"%s\" pvar, check that you have enabled the monitoring pml\n", res->pvar_name);
        PMPI_Abort(MPI_COMM_WORLD, MPIT_result);
    }
}
/* Rendezvous-based messages will never be unexpected (except for the initial RTS,
 * which has an empty buffer anyhow).
 */
void rndv_test()
{
    size_t unexpected_recvq_buffer_size;

    if (rank == 0) {
        int send_buf[RNDV_SIZE] = { 0x5678 };

        MPI_Send(send_buf, RNDV_SIZE, MPI_INT, 1, 0, MPI_COMM_WORLD);
        MPI_Send(send_buf, RNDV_SIZE, MPI_INT, 1, 0, MPI_COMM_WORLD);
    } else if (rank == 1) {
        int recv_buf[RNDV_SIZE];
        MPI_Status status;

        MPI_Recv(recv_buf, RNDV_SIZE, MPI_INT, 0, 0, MPI_COMM_WORLD, &status);
        TRY(MPI_T_pvar_read(session, uqsize_handle, &unexpected_recvq_buffer_size));
        assert(unexpected_recvq_buffer_size == 0);

        MPI_Recv(recv_buf, RNDV_SIZE, MPI_INT, 0, 0, MPI_COMM_WORLD, &status);
        TRY(MPI_T_pvar_read(session, uqsize_handle, &unexpected_recvq_buffer_size));
        assert(unexpected_recvq_buffer_size == 0);
    }

    MPI_Barrier(MPI_COMM_WORLD);  /* make sure this test is over before going to the next one */
}