6b22641669
I know it does not make much sense but one can play around with the performance. Numbers are available at http://www.unixer.de/research/nbcoll/perf/. This is the first step towards collv2. Next step includes the addition of non-blocking functions to the MPI-Layer and the collv1 interface. It implements all MPI-1 collective algorithms in a non-blocking manner. However, the collv1 interface does not allow non-blocking collectives so that all collectives are used blocking by the ompi-glue layer. I wanted to add LibNBC as a separate subdirectory, but I could not convince the buildsystem (and had not the time). So the component looks pretty messy. It would be great if somebody could explain me how to move all nbc*{c,h}, and {hb,dict}*{c,h} to a seperate subdirectory. It's .ompi_ignored because I did not test it exhaustively yet. This commit was SVN r11401.
107 строки
1.7 KiB
C
107 строки
1.7 KiB
C
/*
|
|
* dict.c
|
|
*
|
|
* Implementation of generic dictionary routines.
|
|
* Copyright (C) 2001-2004 Farooq Mela.
|
|
*
|
|
* $Id: dict.c,v 1.7 2001/11/25 06:00:49 farooq Exp farooq $
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "dict.h"
|
|
#include "dict_private.h"
|
|
|
|
dict_malloc_func _dict_malloc = malloc;
|
|
dict_free_func _dict_free = free;
|
|
|
|
dict_malloc_func
|
|
dict_set_malloc(dict_malloc_func func)
|
|
{
|
|
dict_malloc_func old = _dict_malloc;
|
|
_dict_malloc = func ? func : malloc;
|
|
return old;
|
|
}
|
|
|
|
dict_free_func
|
|
dict_set_free(dict_free_func func)
|
|
{
|
|
dict_free_func old = _dict_free;
|
|
_dict_free = func ? func : free;
|
|
return old;
|
|
}
|
|
|
|
/*
|
|
* In comparing, we cannot simply subtract because that might result in signed
|
|
* overflow.
|
|
*/
|
|
int
|
|
dict_int_cmp(const void *k1, const void *k2)
|
|
{
|
|
const int *a = k1, *b = k2;
|
|
|
|
return (*a < *b) ? -1 : (*a > *b) ? +1 : 0;
|
|
}
|
|
|
|
int
|
|
dict_uint_cmp(const void *k1, const void *k2)
|
|
{
|
|
const unsigned int *a = k1, *b = k2;
|
|
|
|
return (*a < *b) ? -1 : (*a > *b) ? +1 : 0;
|
|
}
|
|
|
|
int
|
|
dict_long_cmp(const void *k1, const void *k2)
|
|
{
|
|
const long *a = k1, *b = k2;
|
|
|
|
return (*a < *b) ? -1 : (*a > *b) ? +1 : 0;
|
|
}
|
|
|
|
int
|
|
dict_ulong_cmp(const void *k1, const void *k2)
|
|
{
|
|
const unsigned long *a = k1, *b = k2;
|
|
|
|
return (*a < *b) ? -1 : (*a > *b) ? +1 : 0;
|
|
}
|
|
|
|
int
|
|
dict_ptr_cmp(const void *k1, const void *k2)
|
|
{
|
|
return (k1 > k2) - (k1 < k2);
|
|
}
|
|
|
|
int
|
|
dict_str_cmp(const void *k1, const void *k2)
|
|
{
|
|
const char *a = k1, *b = k2;
|
|
char p, q;
|
|
|
|
for (;;) {
|
|
p = *a++; q = *b++;
|
|
if (p == 0 || p != q)
|
|
break;
|
|
}
|
|
return (p > q) - (p < q);
|
|
}
|
|
|
|
void
|
|
dict_destroy(dict *dct, int del)
|
|
{
|
|
ASSERT(dct != NULL);
|
|
|
|
dct->_destroy(dct->_object, del);
|
|
FREE(dct);
|
|
}
|
|
|
|
void
|
|
dict_itor_destroy(dict_itor *itor)
|
|
{
|
|
ASSERT(itor != NULL);
|
|
|
|
itor->_destroy(itor->_itor);
|
|
FREE(itor);
|
|
}
|