1
1

Fix for lock/unlock epoch issues. Previously, we did not handle the case

where a window was in both the passive and active side of a lock sequence.

Refs trac:488

This commit was SVN r12112.

The following Trac tickets were found above:
  Ticket 488 --> https://svn.open-mpi.org/trac/ompi/ticket/488
Этот коммит содержится в:
Brian Barrett 2006-10-12 22:52:13 +00:00
родитель 3f55d6897a
Коммит 14f338b7df
5 изменённых файлов: 27 добавлений и 6 удалений

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

@ -19,6 +19,7 @@
#include "osc_pt2pt.h"
#include "osc_pt2pt_sendreq.h"
#include "opal/runtime/opal_progress.h"
#include "opal/threads/mutex.h"
#include "ompi/win/win.h"
#include "ompi/communicator/communicator.h"
@ -32,6 +33,10 @@ ompi_osc_pt2pt_module_free(ompi_win_t *win)
int tmp;
ompi_osc_pt2pt_module_t *module = P2P_MODULE(win);
while (OMPI_WIN_EXPOSE_EPOCH & ompi_win_get_mode(win)) {
opal_progress();
}
/* finish with a barrier */
if (ompi_group_size(win->w_group) > 1) {
ret = module->p2p_comm->c_coll.coll_barrier(module->p2p_comm);

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

@ -422,7 +422,8 @@ ompi_osc_pt2pt_module_lock(int lock_type,
assert(lock_type != 0);
/* set our mode on the window */
ompi_win_set_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS);
ompi_win_remove_mode(win, OMPI_WIN_FENCE);
ompi_win_append_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS);
opal_output_verbose(50, ompi_osc_base_output,
"%d sending lock request to %d",
@ -493,7 +494,7 @@ ompi_osc_pt2pt_module_unlock(int target,
out_count);
/* set our mode on the window */
ompi_win_set_mode(win, 0);
ompi_win_remove_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS);
return OMPI_SUCCESS;
}
@ -513,6 +514,7 @@ ompi_osc_pt2pt_passive_lock(ompi_osc_pt2pt_module_t *module,
if (lock_type == MPI_LOCK_EXCLUSIVE) {
if (module->p2p_lock_status == 0) {
module->p2p_lock_status = MPI_LOCK_EXCLUSIVE;
ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
send_ack = true;
} else {
opal_output_verbose(50, ompi_osc_base_output,
@ -527,6 +529,7 @@ ompi_osc_pt2pt_passive_lock(ompi_osc_pt2pt_module_t *module,
if (module->p2p_lock_status != MPI_LOCK_EXCLUSIVE) {
module->p2p_lock_status = MPI_LOCK_SHARED;
module->p2p_shared_count++;
ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
send_ack = true;
} else {
opal_output_verbose(50, ompi_osc_base_output,
@ -573,10 +576,12 @@ ompi_osc_pt2pt_passive_unlock(ompi_osc_pt2pt_module_t *module,
OPAL_THREAD_LOCK(&(module->p2p_lock));
if (module->p2p_lock_status == MPI_LOCK_EXCLUSIVE) {
ompi_win_remove_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
module->p2p_lock_status = 0;
} else {
module->p2p_shared_count--;
if (module->p2p_shared_count == 0) {
ompi_win_remove_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
module->p2p_lock_status = 0;
}
}
@ -589,6 +594,7 @@ ompi_osc_pt2pt_passive_unlock(ompi_osc_pt2pt_module_t *module,
if (NULL != new_pending) {
opal_output_verbose(50, ompi_osc_base_output,
"sending lock request to proc");
ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
/* set lock state and generate a lock request */
module->p2p_lock_status = new_pending->lock_type;
ompi_osc_pt2pt_control_send(module,

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

@ -19,6 +19,7 @@
#include "osc_rdma.h"
#include "osc_rdma_sendreq.h"
#include "opal/runtime/opal_progress.h"
#include "opal/threads/mutex.h"
#include "ompi/win/win.h"
#include "ompi/communicator/communicator.h"
@ -33,6 +34,10 @@ ompi_osc_rdma_module_free(ompi_win_t *win)
int tmp;
ompi_osc_rdma_module_t *module = P2P_MODULE(win);
while (OMPI_WIN_EXPOSE_EPOCH & ompi_win_get_mode(win)) {
opal_progress();
}
/* finish with a barrier */
if (ompi_group_size(win->w_group) > 1) {
ret = module->p2p_comm->c_coll.coll_barrier(module->p2p_comm);

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

@ -460,7 +460,8 @@ ompi_osc_rdma_module_lock(int lock_type,
assert(lock_type != 0);
/* set our mode on the window */
ompi_win_set_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS);
ompi_win_remove_mode(win, OMPI_WIN_FENCE);
ompi_win_append_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS);
opal_output_verbose(50, ompi_osc_base_output,
"%d sending lock request to %d",
@ -531,7 +532,7 @@ ompi_osc_rdma_module_unlock(int target,
out_count);
/* set our mode on the window */
ompi_win_set_mode(win, 0);
ompi_win_remove_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS);
return OMPI_SUCCESS;
}
@ -551,6 +552,7 @@ ompi_osc_rdma_passive_lock(ompi_osc_rdma_module_t *module,
if (lock_type == MPI_LOCK_EXCLUSIVE) {
if (module->p2p_lock_status == 0) {
module->p2p_lock_status = MPI_LOCK_EXCLUSIVE;
ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
send_ack = true;
} else {
opal_output_verbose(50, ompi_osc_base_output,
@ -565,6 +567,7 @@ ompi_osc_rdma_passive_lock(ompi_osc_rdma_module_t *module,
if (module->p2p_lock_status != MPI_LOCK_EXCLUSIVE) {
module->p2p_lock_status = MPI_LOCK_SHARED;
module->p2p_shared_count++;
ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
send_ack = true;
} else {
opal_output_verbose(50, ompi_osc_base_output,
@ -611,10 +614,12 @@ ompi_osc_rdma_passive_unlock(ompi_osc_rdma_module_t *module,
OPAL_THREAD_LOCK(&(module->p2p_lock));
if (module->p2p_lock_status == MPI_LOCK_EXCLUSIVE) {
ompi_win_remove_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
module->p2p_lock_status = 0;
} else {
module->p2p_shared_count--;
if (module->p2p_shared_count == 0) {
ompi_win_remove_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
module->p2p_lock_status = 0;
}
}
@ -627,6 +632,7 @@ ompi_osc_rdma_passive_unlock(ompi_osc_rdma_module_t *module,
if (NULL != new_pending) {
opal_output_verbose(50, ompi_osc_base_output,
"sending lock request to proc");
ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH);
/* set lock state and generate a lock request */
module->p2p_lock_status = new_pending->lock_type;
ompi_osc_rdma_control_send(module,

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

@ -41,8 +41,7 @@ int MPI_Win_free(MPI_Win *win)
if (ompi_win_invalid(*win)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_WIN, FUNC_NAME);
} else if ((OMPI_WIN_ACCESS_EPOCH|OMPI_WIN_EXPOSE_EPOCH) &
ompi_win_get_mode(*win)) {
} else if (OMPI_WIN_ACCESS_EPOCH & ompi_win_get_mode(*win)) {
return OMPI_ERRHANDLER_INVOKE(*win,
MPI_ERR_RMA_SYNC,
FUNC_NAME);