1
1
* Use the prefix rule for global variables
 * Elimiante seed_prng() since it isn't necessary any more

These files will need to get edited again then the RNG type obeys the
prefix rule.

Refs trac:4298

This commit was SVN r30803.

The following SVN revision numbers were found above:
  r30801 --> open-mpi/ompi@e39d9f4080

The following Trac tickets were found above:
  Ticket 4298 --> https://svn.open-mpi.org/trac/ompi/ticket/4298
Этот коммит содержится в:
Jeff Squyres 2014-02-24 17:47:52 +00:00
родитель 5ed50793d5
Коммит 1b855eca8e
3 изменённых файлов: 10 добавлений и 27 удалений

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

@ -58,7 +58,7 @@ get_nsec(void)
}
/* RNG buffer declaration */
extern rng_buff_t rand_buff;
extern rng_buff_t ompi_btl_usnic_rand_buff;
#ifndef container_of
#define container_of(ptr, type, member) ( \
@ -101,19 +101,19 @@ extern rng_buff_t rand_buff;
#if WANT_RECV_FRAG_DROPS > 0
//#define FAKE_RECV_FRAG_DROP (rand() < WANT_RECV_FRAG_DROPS)
#define FAKE_RECV_FRAG_DROP (opal_rand(&rand_buff) < WANT_RECV_FRAG_DROPS)
#define FAKE_RECV_FRAG_DROP (opal_rand(&ompi_btl_usnic_rand_buff) < WANT_RECV_FRAG_DROPS)
#else
#define FAKE_RECV_FRAG_DROP 0
#endif
#if WANT_FAIL_TO_SEND_ACK > 0
#define FAKE_FAIL_TO_SEND_ACK (opal_rand(&rand_buff) < WANT_FAIL_TO_SEND_ACK)
#define FAKE_FAIL_TO_SEND_ACK (opal_rand(&ompi_btl_usnic_rand_buff) < WANT_FAIL_TO_SEND_ACK)
#else
#define FAKE_FAIL_TO_SEND_ACK 0
#endif
#if WANT_FAIL_TO_RESEND_FRAG > 0
#define FAKE_FAIL_TO_RESEND_FRAG (opal_rand(&rand_buff) < WANT_FAIL_TO_RESEND_FRAG)
#define FAKE_FAIL_TO_RESEND_FRAG (opal_rand(&ompi_btl_usnic_rand_buff) < WANT_FAIL_TO_RESEND_FRAG)
#else
#define FAKE_FAIL_TO_RESEND_FRAG 0
#endif

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

@ -80,10 +80,11 @@
#define max(a,b) ((a) > (b) ? (a) : (b))
/* RNG buffer definition */
rng_buff_t rand_buff;
rng_buff_t ompi_btl_usnic_rand_buff;
/* simulated clock */
uint64_t ompi_btl_usnic_ticks = 0;
static opal_event_t usnic_clock_timer_event;
static bool usnic_clock_timer_event_set = false;
static struct timeval usnic_clock_timeout;
@ -98,7 +99,6 @@ static mca_btl_base_module_t **
usnic_component_init(int* num_btl_modules, bool want_progress_threads,
bool want_mpi_threads);
static int usnic_component_progress(void);
static void seed_prng(void);
static bool port_is_usnic(ompi_common_verbs_port_item_t *port);
static int init_module_from_port(ompi_btl_usnic_module_t *module,
ompi_common_verbs_port_item_t *port);
@ -521,11 +521,8 @@ static mca_btl_base_module_t** usnic_component_init(int* num_btl_modules,
mca_btl_usnic_component.my_hashed_rte_name =
ompi_rte_hash_name(&(ompi_proc_local()->proc_name));
/* JSL - I don't see lrand48 used anywhere in usnic
seed_prng();
*/
opal_srand(&ompi_btl_usnic_rand_buff, ((uint32_t) getpid()));
opal_srand(&rand_buff, ((uint32_t) getpid()));
/* Find the ports that we want to use. We do our own interface name
* filtering below, so don't let the verbs code see our
* if_include/if_exclude strings */
@ -1119,16 +1116,6 @@ static int usnic_component_progress_2(void)
return count;
}
static void seed_prng(void)
{
unsigned short seedv[3];
seedv[0] = OMPI_PROC_MY_NAME->vpid;
seedv[1] = opal_timer_base_get_cycles();
usleep(1);
seedv[2] = opal_timer_base_get_cycles();
seed48(seedv);
}
static bool port_is_usnic(ompi_common_verbs_port_item_t *port)
{
bool is_usnic = false;

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

@ -11,7 +11,7 @@
* All rights reserved.
* Copyright (c) 2006 Sandia National Laboratories. All rights
* reserved.
* Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -1817,12 +1817,8 @@ get_initial_seq_no(void)
{
ompi_btl_usnic_seq_t isn;
/* only utilize the bottom 62 bits to avoid hitting seq # overflow */
/* JSL
isn = (((uint64_t)random() & ((1LL<<30)-1)) << 32) |
((uint64_t)random() & ((1LL<<32)-1));
*/
isn = (((uint64_t)opal_rand(&rand_buff) & ((1LL<<30)-1)) << 32) |
((uint64_t)opal_rand(&rand_buff) & ((1LL<<32)-1));
isn = (((uint64_t)opal_rand(&ompi_btl_usnic_rand_buff) & ((1LL<<30)-1)) << 32) |
((uint64_t)opal_rand(&ompi_btl_usnic_rand_buff) & ((1LL<<32)-1));
isn += 2; /* guarantee > 1 */
return isn;