OpenMPI  0.1.1
osc_rdma_obj_convert.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University.
3  * All rights reserved.
4  * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
5  * All rights reserved.
6  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
7  * University of Stuttgart. All rights reserved.
8  * Copyright (c) 2004-2005 The Regents of the University of California.
9  * All rights reserved.
10  * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
11  * reserved.
12  * Copyright (c) 2010 IBM Corporation. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 /*
21  * utility functions for dealing with remote datatype and op structures
22  */
23 
24 /**
25  * Convert a window index number into a module instance.
26  */
27 static inline ompi_osc_rdma_module_t*
28 ompi_osc_rdma_windx_to_module(uint32_t windx)
29 {
30  int ret;
31  ompi_osc_rdma_module_t *module;
32 
33  /* find the right module and dispatch */
34  OPAL_THREAD_LOCK(&mca_osc_rdma_component.c_lock);
35  ret = opal_hash_table_get_value_uint32(&mca_osc_rdma_component.c_modules,
36  windx,
37  (void**) (&module));
38  OPAL_THREAD_UNLOCK(&mca_osc_rdma_component.c_lock);
39  if (OMPI_SUCCESS != ret) {
40  opal_output(0, "Could not translate windx %d to a local MPI_Win instance",
41  windx);
42  return NULL;
43  }
44 
45  return module;
46 }
Definition: osc_rdma.h:111
#define OPAL_THREAD_LOCK(mutex)
Lock a mutex if opal_using_threads() says that multiple threads may be active in the process...
Definition: mutex.h:223
#define OPAL_THREAD_UNLOCK(mutex)
Unlock a mutex if opal_using_threads() says that multiple threads may be active in the process...
Definition: mutex.h:309
OPAL_DECLSPEC void opal_output(int output_id, const char *format,...) __opal_attribute_format__(__printf__
Main function to send output to a stream.
opal_hash_table_t c_modules
List of ompi_osc_rdma_module_ts currently in existance.
Definition: osc_rdma.h:55
opal_mutex_t c_lock
lock access to datastructures in the component structure
Definition: osc_rdma.h:50
OPAL_DECLSPEC int opal_hash_table_get_value_uint32(opal_hash_table_t *table, uint32_t key, void **ptr)
Retrieve value via uint32_t key.
Definition: opal_hash_table.c:128