コード例 #1
0
ファイル: test_scatter_x.c プロジェクト: caomw/BigMPI
int main(int argc, char * argv[])
{
    const MPI_Count test_int_max = BigMPI_Get_max_int();

    MPI_Init(&argc, &argv);

    int rank, size;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    if (size<1) {
        printf("Use 1 or more processes. \n");
        MPI_Finalize();
        return 1;
    }

    int l = (argc > 1) ? atoi(argv[1]) : 2;
    int m = (argc > 2) ? atoi(argv[2]) : 17777;
    MPI_Count n = l * test_int_max + m;

    char * buf_send = NULL;
    char * buf_recv = NULL;

    MPI_Alloc_mem((MPI_Aint)n * size, MPI_INFO_NULL, &buf_send);
    assert(buf_send!=NULL);
    MPI_Alloc_mem((MPI_Aint)n,        MPI_INFO_NULL, &buf_recv);
    assert(buf_recv!=NULL);

    if (rank==0) {
        for (int i = 0; i < size; ++i) {
            for (MPI_Count j = 0; j < n; ++j) {
                buf_send[i*n+j] = (unsigned char)i;
            }
        }
    }
    memset(buf_recv, -1, (size_t)n);

    /* collective communication */
    MPIX_Scatter_x(buf_send, n, MPI_CHAR,
                   buf_recv, n, MPI_CHAR,
                   0 /* root */, MPI_COMM_WORLD);

    size_t errors = verify_buffer(buf_recv, n, rank);

    MPI_Free_mem(buf_send);
    MPI_Free_mem(buf_recv);

    if (rank==0 && errors==0) {
        printf("SUCCESS\n");
    }

    MPI_Finalize();

    return 0;
}
コード例 #2
0
ファイル: benchmark.c プロジェクト: OP-TEE/optee_test
static TEE_Result verify_file_data(TEE_ObjectHandle object, size_t data_size,
		uint8_t *chunk_buf, size_t chunk_size)
{
	TEE_Result res;
	size_t tmp_data_size = data_size;

	res = TEE_SeekObjectData(object, 0, TEE_DATA_SEEK_SET);
	if (res != TEE_SUCCESS) {
		EMSG("Failed to seek to offset 0");
		goto exit;
	}

	TEE_MemFill(chunk_buf, 0, chunk_size);

	tmp_data_size = data_size;
	while (tmp_data_size > 0) {
		uint32_t read_bytes = 0;

		res = TEE_ReadObjectData(object, chunk_buf, chunk_size,
				&read_bytes);
		if (res != TEE_SUCCESS) {
			EMSG("Failed to read data, res=0x%08x", res);
			goto exit;
		}

		if (read_bytes != chunk_size) {
			EMSG("Data size not match");
			res = TEE_ERROR_CORRUPT_OBJECT;
			goto exit;
		}

		res = verify_buffer(chunk_buf, chunk_size);
		if (res != TEE_SUCCESS) {
			EMSG("Verify data failed, res=0x%08x", res);
			goto exit;
		}

		tmp_data_size -= chunk_size;
	}

exit:
	return res;
}
コード例 #3
0
ファイル: protocol_client_test.c プロジェクト: m-h-w/samba
static void verify_ctdb_req_header(struct ctdb_req_header *h,
				   struct ctdb_req_header *h2)
{
	verify_buffer(h, h2, sizeof(struct ctdb_req_header));
}