openmpi  3.1.6
About: Open MPI is a high performance Message Passing Interface (MPI) library project combining technologies and resources from several other projects (FT-MPI, LA-MPI, LAM/MPI, and PACX-MPI) in order to build the best MPI library available. 3.x series.
  Fossies Dox: openmpi-3.1.6.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

opal_pointer_array.h File Reference
#include "opal_config.h"
#include "opal/threads/mutex.h"
#include "opal/class/opal_object.h"
#include "opal/prefetch.h"
Include dependency graph for opal_pointer_array.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  opal_pointer_array_t
 dynamic pointer array More...
 

Typedefs

typedef struct opal_pointer_array_t opal_pointer_array_t
 Convenience typedef. More...
 

Functions

OPAL_DECLSPEC OBJ_CLASS_DECLARATION (opal_pointer_array_t)
 Class declaration. More...
 
OPAL_DECLSPEC int opal_pointer_array_init (opal_pointer_array_t *array, int initial_allocation, int max_size, int block_size)
 Initialize the pointer array with an initial size of initial_allocation. More...
 
OPAL_DECLSPEC int opal_pointer_array_add (opal_pointer_array_t *array, void *ptr)
 Add a pointer to the array (Grow the array, if need be) More...
 
OPAL_DECLSPEC int opal_pointer_array_set_item (opal_pointer_array_t *array, int index, void *value)
 Set the value of an element in array. More...
 
static void * opal_pointer_array_get_item (opal_pointer_array_t *table, int element_index)
 Get the value of an element in array. More...
 
static int opal_pointer_array_get_size (opal_pointer_array_t *array)
 Get the size of the pointer array. More...
 
OPAL_DECLSPEC int opal_pointer_array_set_size (opal_pointer_array_t *array, int size)
 Set the size of the pointer array. More...
 
OPAL_DECLSPEC bool opal_pointer_array_test_and_set_item (opal_pointer_array_t *table, int index, void *value)
 Test whether a certain element is already in use. More...
 
static void opal_pointer_array_remove_all (opal_pointer_array_t *array)
 Empty the array. More...
 

Detailed Description

Utility functions to manage fortran <-> c opaque object translation. Note that since MPI defines fortran handles as [signed] int's, we use int everywhere in here where you would normally expect size_t. There's some code that makes sure indices don't go above FORTRAN_HANDLE_MAX (which is min(INT_MAX, fortran INTEGER max)), just to be sure.

Definition in file opal_pointer_array.h.

Typedef Documentation

◆ opal_pointer_array_t

Convenience typedef.

Definition at line 38 of file opal_pointer_array.h.

Function Documentation

◆ OBJ_CLASS_DECLARATION()

OPAL_DECLSPEC OBJ_CLASS_DECLARATION ( opal_pointer_array_t  )

Class declaration.

◆ opal_pointer_array_add()

OPAL_DECLSPEC int opal_pointer_array_add ( opal_pointer_array_t table,
void *  ptr 
)

Add a pointer to the array (Grow the array, if need be)

Parameters
arrayPointer to array (IN)
ptrPointer value (IN)
Returns
Index of inserted array element. Return value of (-1) indicates an error.

Add a pointer to the array (Grow the array, if need be)

Parameters
tablePointer to opal_pointer_array_t object (IN)
ptrPointer to be added to table (IN)
Returns
Array index where ptr is inserted or OPAL_ERROR if it fails

Definition at line 220 of file opal_pointer_array.c.

References opal_pointer_array_t::addr, FIND_FIRST_ZERO, grow_table(), opal_pointer_array_t::lock, opal_pointer_array_t::lowest_free, NULL, opal_pointer_array_t::number_free, OPAL_ERR_OUT_OF_RESOURCE, OPAL_THREAD_LOCK, OPAL_THREAD_UNLOCK, SET_BIT, and opal_pointer_array_t::size.

Referenced by _terminate_job(), _toolconn(), add_procs_block_create_endpoints(), allocate(), byobj_span(), config_window(), construct_ftgrps(), file_constructor(), group_register(), info_constructor(), info_register_framework(), init(), init_ib_proc_nolock(), init_one_port(), killprocs(), map_to_ftgrps(), mca_base_pvar_register(), mca_btl_ugni_frag_init(), mca_btl_ugni_init_ep(), mca_pml_base_open(), mca_pml_monitoring_component_open(), mca_spml_base_open(), mindist_map(), MPI_Message_c2f(), MPI_Request_c2f(), MPI_Type_c2f(), ompi_comm_construct(), ompi_errhandler_construct(), ompi_group_construct(), ompi_info_register_types(), ompi_message_init(), ompi_op_construct(), ompi_request_init(), opal_bp_graph_add_vertex(), opal_graph_get_graph_vertices(), opal_info_register_types(), orte_daemon(), orte_daemon_recv(), orte_data_server(), orte_dt_unpack_job(), orte_ess_base_orted_setup(), orte_info_register_types(), orte_odls_base_default_construct_child_list(), orte_odls_base_default_kill_local_procs(), orte_plm_base_daemon_callback(), orte_plm_base_orted_terminate_job(), orte_plm_base_setup_virtual_machine(), orte_ras_base_node_insert(), orte_regx_base_decode_daemon_nodemap(), orte_regx_base_parse_ppn(), orte_rmaps_base_setup_proc(), orte_rmaps_resilient_map(), orte_rmaps_rf_map(), orte_rmaps_rr_bynode(), orte_rmaps_rr_byobj(), orte_rmaps_rr_byslot(), orte_rmaps_seq_map(), orte_rml_API_open_conduit(), orte_submit_job(), oshmem_info_register_types(), oshmem_proc_group_create(), oshmem_request_init(), parse_appfile(), parse_locals(), pmix_server_job_ctrl_fn(), pmix_server_spawn_fn(), ppr_mapper(), prepare_device_for_use(), register_variable(), rte_init(), and setup_debugger_job().

◆ opal_pointer_array_get_item()

static void* opal_pointer_array_get_item ( opal_pointer_array_t table,
int  element_index 
)
inlinestatic

Get the value of an element in array.

Parameters
arrayPointer to array (IN)
element_indexIndex of element to be returned (IN)
Returns
Error code. NULL indicates an error.

Definition at line 125 of file opal_pointer_array.h.

References opal_pointer_array_t::addr, opal_pointer_array_t::lock, NULL, OPAL_THREAD_LOCK, OPAL_THREAD_UNLOCK, OPAL_UNLIKELY, and opal_pointer_array_t::size.

Referenced by _client_abort(), _client_conn(), _client_finalized(), _query(), _toolconn(), allocate(), allocation_complete(), any_live_children(), assign_locations(), bind_downwards(), bind_in_place(), bind_to_cpuset(), bind_upwards(), btl_openib_component_progress(), check_complete(), cleanup_node(), complete_recv(), compute_num_procs_alive(), construct_ftgrps(), create_dmns(), create_new_handle_info(), dmodex_req(), dump_aborted_procs(), dyn_allocate(), failed_start(), file_destructor(), filem_base_process_get_proc_node_name_cmd(), finalize(), flag_nodes(), ftgrp_res_destruct(), get_ftgrp_target(), get_new_node(), global_coord_start_ckpt(), global_init_job_structs(), global_refresh_job_structs(), handle_wc(), hnp_push(), info_destructor(), init_apm_port(), jtrk_des(), launch_daemons(), launch_recv(), main(), map_to_ftgrps(), mca_base_pvar_finalize(), mca_base_pvar_get_internal(), mca_base_var_build_env(), mca_base_var_finalize(), mca_base_var_group_finalize(), mca_base_var_group_get_internal(), mca_btl_openib_del_procs(), mca_btl_openib_finalize_resources(), mca_btl_ugni_get_datagram_device(), mca_btl_ugni_handle_remote_smsg_overrun(), mca_btl_ugni_progress_local_smsg(), mca_btl_ugni_progress_remote_smsg(), mca_pml_base_close(), mca_pml_base_select(), mca_spml_base_close(), mca_spml_base_select(), mindist_map(), MPI_Comm_f2c(), MPI_Errhandler_f2c(), MPI_File_f2c(), MPI_Group_f2c(), MPI_Info_f2c(), MPI_Message_f2c(), MPI_Op_f2c(), MPI_Request_f2c(), MPI_Type_f2c(), MPI_Win_f2c(), nidmap_create(), notify_collectives(), ompi_comm_destruct(), ompi_comm_finalize(), ompi_comm_free(), ompi_comm_lookup(), ompi_datatype_finalize(), ompi_datatype_init(), ompi_datatype_match_size(), ompi_dpm_dyn_finalize(), ompi_errcode_get_mpi_code(), ompi_errhandler_destruct(), ompi_file_finalize(), ompi_group_destruct(), ompi_mpi_errcode_finalize(), ompi_mpi_errcode_get_class(), ompi_mpi_errnum_add_string(), ompi_mpi_errnum_get_string(), ompi_mpi_errnum_is_class(), ompi_mpiinfo_finalize(), ompi_odls_base_default_wait_local_proc(), ompi_op_destruct(), ompi_win_finalize(), opal_dss_close(), opal_dss_compare(), opal_dss_copy(), opal_dss_dump_data_types(), opal_dss_get_data_type(), opal_dss_lookup_data_type(), opal_dss_pack_buffer(), opal_dss_print(), opal_dss_register(), opal_dss_store_data_type(), opal_dss_structured(), opal_dss_unpack_buffer(), opal_info_do_params(), opal_info_err_params(), opal_info_show_component_version(), orte_app_context_destructor(), orte_daemon(), orte_daemon_recv(), orte_data_server(), orte_data_server_finalize(), orte_debugger_init_after_spawn(), orte_debugger_init_before_spawn(), orte_dt_pack_job(), orte_dt_print_job(), orte_dt_print_map(), orte_dt_print_node(), orte_dt_unpack_job(), orte_get_lowest_vpid_alive(), orte_get_proc_daemon_vpid(), orte_get_proc_object(), orte_info_components_close(), orte_info_do_params(), orte_info_do_version(), orte_info_show_component_version(), orte_job_destruct(), orte_job_map_destruct(), orte_node_destruct(), orte_odls_base_close(), orte_odls_base_default_construct_child_list(), orte_odls_base_default_get_add_procs_data(), orte_odls_base_default_kill_local_procs(), orte_odls_base_default_launch_local(), orte_odls_base_default_restart_proc(), orte_odls_base_default_signal_local_procs(), orte_odls_base_get_proc_stats(), orte_plm_base_complete_setup(), orte_plm_base_daemon_callback(), orte_plm_base_daemon_failed(), orte_plm_base_daemon_topology(), orte_plm_base_daemons_reported(), orte_plm_base_orted_kill_local_procs(), orte_plm_base_recv(), orte_plm_base_setup_job(), orte_plm_base_setup_virtual_machine(), orte_pmix_server_register_nspace(), orte_pre_condition_transports(), orte_profile_wakeup(), orte_ras_base_add_hosts(), orte_ras_base_allocate(), orte_ras_base_display_alloc(), orte_ras_base_node_insert(), orte_regx_base_decode_daemon_nodemap(), orte_regx_base_encode_nodemap(), orte_regx_base_generate_ppn(), orte_regx_base_nidmap_parse(), orte_regx_base_parse_ppn(), orte_rmaps_base_compute_bindings(), orte_rmaps_base_compute_local_ranks(), orte_rmaps_base_compute_vpids(), orte_rmaps_base_display_map(), orte_rmaps_base_get_target_nodes(), orte_rmaps_base_map_job(), orte_rmaps_base_update_local_ranks(), orte_rmaps_rank_file_parse(), orte_rmaps_resilient_map(), orte_rmaps_rf_map(), orte_rmaps_rr_assign_byobj(), orte_rmaps_rr_assign_root_level(), orte_rmaps_rr_map(), orte_rmaps_seq_map(), orte_rml_API_close_conduit(), orte_rml_API_get_routed(), orte_rml_API_ping(), orte_rml_API_purge(), orte_rml_API_send_buffer_nb(), orte_rml_API_send_nb(), orte_rml_base_close(), orte_routed_base_process_callback(), orte_routed_base_xcast_routing(), orte_snapc_base_quiesce_destruct(), orte_sstore_stage_local_fetch_app_deps(), orte_state_base_check_all_complete(), orte_state_base_track_procs(), orte_submit_cancel(), orte_submit_finalize(), orte_submit_job(), orte_timeout_wakeup(), orte_util_add_dash_host_nodes(), orte_util_comm_report_event(), orte_util_filter_hostfile_nodes(), orte_util_get_ordered_host_list(), oshmem_proc_group_destroy(), oshmem_proc_group_finalize(), pack_state_update(), parse_dash_host(), parse_locals(), parseable_print(), pmix_server_dmdx_recv(), pmix_server_job_ctrl_fn(), pmix_server_spawn_fn(), ppr_mapper(), proc_errors(), process_opens(), prune(), qp2endpoint(), rank_by(), rank_fill(), rank_span(), raw_link_local_files(), raw_preposition_files(), recv_data(), register_variable(), reset_usage(), rsh_finalize(), set(), setup_fork(), snapc_full_local_get_vpids(), snapc_full_local_refresh_vpids(), track_jobs(), track_procs(), unbind_procs(), update_routing_plan(), usnic_del_procs(), var_get(), vm_ready(), and xcast_recv().

◆ opal_pointer_array_get_size()

◆ opal_pointer_array_init()

OPAL_DECLSPEC int opal_pointer_array_init ( opal_pointer_array_t array,
int  initial_allocation,
int  max_size,
int  block_size 
)

Initialize the pointer array with an initial size of initial_allocation.

Set the maximum size of the array, as well as the size of the allocation block for all subsequent growing operations. Remarque: The pointer array has to be created bfore calling this function.

Parameters
arrayPointer to pointer of an array (IN/OUT)
initial_allocationThe number of elements in the initial array (IN)
max_sizeThe maximum size of the array (IN)
block_sizeThe size for all subsequent grows of the array (IN).
Returns
OPAL_SUCCESS if all initializations were succesfull. Otherwise, the error indicate what went wrong in the function.

Initialize the pointer array with an initial size of initial_allocation.

Definition at line 178 of file opal_pointer_array.c.

References opal_pointer_array_t::addr, opal_pointer_array_t::block_size, free(), opal_pointer_array_t::free_bits, opal_pointer_array_t::lowest_free, opal_pointer_array_t::max_size, NULL, opal_pointer_array_t::number_free, OPAL_ERR_BAD_PARAM, OPAL_ERR_OUT_OF_RESOURCE, OPAL_SUCCESS, opal_pointer_array_t::size, and TYPE_ELEM_COUNT.

Referenced by _terminate_job(), ftgrp_res_construct(), init(), init_one_device(), init_procs(), jtrk_cons(), main(), mca_base_pvar_init(), mca_base_var_group_init(), mca_base_var_init(), mca_btl_ugni_add_procs(), mca_btl_ugni_setup_mpools(), ompi_comm_init(), ompi_datatype_init(), ompi_errcode_intern_init(), ompi_errhandler_init(), ompi_file_init(), ompi_group_init(), ompi_mpi_errcode_init(), ompi_mpiinfo_init(), ompi_request_init(), ompi_win_init(), opal_bp_graph_create(), opal_dss_open(), orte_app_context_construct(), orte_daemon_recv(), orte_data_server_init(), orte_ess_base_orted_setup(), orte_info_components_open(), orte_job_construct(), orte_job_map_construct(), orte_node_construct(), orte_odls_base_default_kill_local_procs(), orte_odls_base_open(), orte_plm_base_orted_terminate_job(), orte_rml_base_open(), orte_snapc_base_quiesce_construct(), orte_submit_init(), oshmem_op_init(), oshmem_proc_group_init(), oshmem_request_init(), prepare_device_for_use(), rank_by(), and rte_init().

◆ opal_pointer_array_remove_all()

static void opal_pointer_array_remove_all ( opal_pointer_array_t array)
inlinestatic

◆ opal_pointer_array_set_item()

OPAL_DECLSPEC int opal_pointer_array_set_item ( opal_pointer_array_t table,
int  index,
void *  value 
)

Set the value of an element in array.

Parameters
arrayPointer to array (IN)
indexIndex of element to be reset (IN)
valueNew value to be set at element index (IN)
Returns
Error code. (-1) indicates an error.

Set the value of an element in array.

Parameters
tablePointer to opal_pointer_array_t object (IN)
ptrPointer to be added to table (IN)
Returns
Error code

Assumption: NULL element is free element.

Definition at line 271 of file opal_pointer_array.c.

References opal_pointer_array_t::addr, FIND_FIRST_ZERO, grow_table(), opal_pointer_array_t::lock, opal_pointer_array_t::lowest_free, NULL, opal_pointer_array_t::number_free, OPAL_ERROR, opal_output(), OPAL_SUCCESS, OPAL_THREAD_LOCK, OPAL_THREAD_UNLOCK, OPAL_UNLIKELY, SET_BIT, opal_pointer_array_t::size, UNSET_BIT, and value.

Referenced by __ompi_datatype_release(), check_complete(), cleanup_node(), complete_recv(), file_destructor(), info_destructor(), launch_recv(), mca_btl_openib_del_procs(), mca_btl_openib_finalize_resources(), mca_btl_ugni_release_ep(), ompi_comm_checkcid(), ompi_comm_destruct(), ompi_comm_init(), ompi_comm_nextcid_check_flag(), ompi_errcode_intern_destruct(), ompi_errcode_intern_init(), ompi_errhandler_destruct(), ompi_file_finalize(), ompi_file_init(), ompi_group_destruct(), ompi_message_return(), ompi_mpi_errclass_add(), ompi_mpi_errcode_add(), ompi_mpi_errcode_destruct(), ompi_op_destruct(), ompi_win_free(), ompi_win_init(), opal_bp_graph_free(), opal_dss_close(), opal_dss_register(), orte_daemon_recv(), orte_data_server(), orte_ess_base_orted_setup(), orte_job_map_destruct(), orte_node_destruct(), orte_odls_base_default_construct_child_list(), orte_plm_base_setup_virtual_machine(), orte_regx_base_nidmap_parse(), orte_rmaps_base_compute_vpids(), orte_rmaps_rank_file_parse(), orte_rmaps_rf_map(), orte_rmaps_seq_map(), orte_rml_API_close_conduit(), orte_state_base_check_all_complete(), oshmem_proc_group_destroy(), proc_errors(), prune(), rank_by(), rank_fill(), rank_span(), recv_data(), rte_init(), track_procs(), and usnic_del_procs().

◆ opal_pointer_array_set_size()

OPAL_DECLSPEC int opal_pointer_array_set_size ( opal_pointer_array_t array,
int  size 
)

Set the size of the pointer array.

Parameters
arrayPointer to array (IN)
sizeDesired size of the array

Simple function to set the size of the array in order to hide the member field from external users.

Definition at line 400 of file opal_pointer_array.c.

References grow_table(), opal_pointer_array_t::lock, OPAL_ERROR, OPAL_SUCCESS, OPAL_THREAD_LOCK, OPAL_THREAD_UNLOCK, and opal_pointer_array_t::size.

Referenced by orte_ras_base_node_insert().

◆ opal_pointer_array_test_and_set_item()

OPAL_DECLSPEC bool opal_pointer_array_test_and_set_item ( opal_pointer_array_t table,
int  index,
void *  value 
)

Test whether a certain element is already in use.

If not yet in use, reserve it.

Parameters
arrayPointer to array (IN)
indexIndex of element to be tested (IN)
valueNew value to be set at element index (IN)
Returns
true/false True if element could be reserved False if element could not be reserved (e.g., in use).

In contrary to array_set, this function does not allow to overwrite a value, unless the previous value is NULL ( equiv. to free ).

If not yet in use, reserve it.

Parameters
arrayPointer to array (IN)
indexIndex of element to be tested (IN)
valueNew value to be set at element index (IN)
Returns
true/false True if element could be reserved False if element could not be reserved (e.g.in use).

In contrary to array_set, this function does not allow to overwrite a value, unless the previous value is NULL ( equiv. to free ).

Definition at line 340 of file opal_pointer_array.c.

References opal_pointer_array_t::addr, FIND_FIRST_ZERO, grow_table(), opal_pointer_array_t::lock, opal_pointer_array_t::lowest_free, NULL, opal_pointer_array_t::number_free, opal_output(), OPAL_THREAD_LOCK, OPAL_THREAD_UNLOCK, SET_BIT, opal_pointer_array_t::size, and value.

Referenced by ompi_comm_allreduce_getnextcid(), ompi_comm_checkcid(), and ompi_comm_nextcid_check_flag().