1
1

More efficient way of waiting for asynchronous copy to complete.

This commit was SVN r31420.
Этот коммит содержится в:
Rolf vandeVaart 2014-04-17 15:18:50 +00:00
родитель a03b11c20e
Коммит a6a245b5b5
2 изменённых файлов: 13 добавлений и 24 удалений

Просмотреть файл

@ -96,6 +96,7 @@ struct cudaFunctionTable {
#endif /* OPAL_CUDA_GDR_SUPPORT */
int (*cuCtxSetCurrent)(CUcontext);
int (*cuEventSynchronize)(CUevent);
int (*cuStreamSynchronize)(CUstream);
} cudaFunctionTable;
typedef struct cudaFunctionTable cudaFunctionTable_t;
cudaFunctionTable_t cuFunc;
@ -113,7 +114,6 @@ static CUstream ipcStream;
static CUstream dtohStream;
static CUstream htodStream;
static CUstream memcpyStream;
static CUevent memcpyEvent;
/* Functions called by opal layer - plugged into opal function table */
static int mca_common_cuda_is_gpu_buffer(const void*);
@ -491,6 +491,7 @@ int mca_common_cuda_stage_one_init(void)
#endif /* OPAL_CUDA_GDR_SUPPORT */
OMPI_CUDA_DLSYM(libcuda_handle, cuCtxSetCurrent);
OMPI_CUDA_DLSYM(libcuda_handle, cuEventSynchronize);
OMPI_CUDA_DLSYM(libcuda_handle, cuStreamSynchronize);
return 0;
}
@ -733,13 +734,6 @@ static int mca_common_cuda_stage_three_init(void)
true, ompi_process_info.nodename, res);
return OMPI_ERROR;
}
/* Create event for use in cuMemcpyAsync synchronous copies */
res = cuFunc.cuEventCreate(&memcpyEvent, 0);
if (OPAL_UNLIKELY(res != CUDA_SUCCESS)) {
opal_show_help("help-mpi-common-cuda.txt", "cuEventCreate failed",
true, ompi_process_info.nodename, res);
return OMPI_ERROR;
}
}
opal_output_verbose(30, mca_common_cuda_output,
@ -1652,15 +1646,9 @@ static int mca_common_cuda_cu_memcpy(void *dest, const void *src, size_t size)
true, dest, src, size, result);
return OMPI_ERROR;
}
result = cuFunc.cuEventRecord(memcpyEvent, memcpyStream);
result = cuFunc.cuStreamSynchronize(memcpyStream);
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
opal_show_help("help-mpi-common-cuda.txt", "cuEventRecord failed",
true, ompi_process_info.nodename, result);
return 0;
}
result = cuFunc.cuEventSynchronize(memcpyEvent);
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
opal_show_help("help-mpi-common-cuda.txt", "cuEventSynchronize failed",
opal_show_help("help-mpi-common-cuda.txt", "cuStreamSynchronize failed",
true, ompi_process_info.nodename, result);
return OMPI_ERROR;
}
@ -1707,15 +1695,9 @@ static int mca_common_cuda_memmove(void *dest, void *src, size_t size)
true, dest, tmp, size, result);
return OMPI_ERROR;
}
result = cuFunc.cuEventRecord(memcpyEvent, memcpyStream);
result = cuFunc.cuStreamSynchronize(memcpyStream);
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
opal_show_help("help-mpi-common-cuda.txt", "cuEventRecord failed",
true, ompi_process_info.nodename, result);
return OMPI_ERROR;
}
result = cuFunc.cuEventSynchronize(memcpyEvent);
if (OPAL_UNLIKELY(CUDA_SUCCESS != result)) {
opal_show_help("help-mpi-common-cuda.txt", "cuEventSynchronize failed",
opal_show_help("help-mpi-common-cuda.txt", "cuStreamSynchronize failed",
true, ompi_process_info.nodename, result);
return OMPI_ERROR;
}

Просмотреть файл

@ -192,3 +192,10 @@ not happen. Please report this error to the Open MPI developers.
cuEventSynchronize return value: %d
Check the cuda.h file for what the return value means.
#
[cuStreamSynchronize failed]
The call to cuStreamSynchronize failed. This is highly unusual and should
not happen. Please report this error to the Open MPI developers.
Hostname: %s
cuStreamSynchronize return value: %d
Check the cuda.h file for what the return value means.
#