1
1

Remove memory tests, as they're out of date

This commit was SVN r18656.
Этот коммит содержится в:
Brian Barrett 2008-06-14 14:01:05 +00:00
родитель 7712b07ac4
Коммит 8cff3131d6
6 изменённых файлов: 1 добавлений и 433 удалений

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

@ -1313,7 +1313,6 @@ AC_CONFIG_FILES([
test/event/Makefile
test/asm/Makefile
test/class/Makefile
test/memory/Makefile
test/support/Makefile
test/threads/Makefile
test/peruse/Makefile

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

@ -19,5 +19,5 @@
# support needs to be first for dependencies
SUBDIRS = support asm class memory threads peruse datatype
SUBDIRS = support asm class threads peruse datatype
DIST_SUBDIRS = event $(SUBDIRS)

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

@ -1,46 +0,0 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
check_PROGRAMS = \
opal_memory_basic \
opal_memory_speed \
opal_memory_cxx
# JMS to be re-added when #1232 is fixed
#TESTS = $(check_PROGRAMS)
TEST =
opal_memory_basic_SOURCES = opal_memory_basic.c
opal_memory_basic_LDFLAGS = $(WRAPPER_EXTRA_LDFLAGS)
opal_memory_basic_LDADD = \
$(top_builddir)/opal/libopen-pal.la
opal_memory_basic_DEPENDENCIES = $(opal_memory_basic_LDADD)
opal_memory_speed_SOURCES = opal_memory_speed.c
opal_memory_speed_LDFLAGS = $(WRAPPER_EXTRA_LDFLAGS)
opal_memory_speed_LDADD = \
$(top_builddir)/opal/libopen-pal.la
opal_memory_speed_DEPENDENCIES = $(opal_memory_speed_LDADD)
opal_memory_cxx_SOURCES = opal_memory_cxx.cc
opal_memory_cxx_LDFLAGS = $(WRAPPER_EXTRA_LDFLAGS)
opal_memory_cxx_LDADD = \
$(top_builddir)/opal/libopen-pal.la
opal_memory_cxx_DEPENDENCIES = $(opal_memory_cxx_LDADD)

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

@ -1,137 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/mman.h>
#include <assert.h>
#include "ompi/constants.h"
#include "opal/runtime/opal.h"
#include "opal/memoryhooks/memory.h"
/*
* The counter variable is volatile to avoid (wrong) compiler optimisations,
* which can lead to wrong code.
*/
volatile int counter = 0;
const int bigsize = 100 * 1024 * 1024;
static void
alloc_callback(void *buf, size_t length, void *cbdata, bool extra)
{
counter++;
}
static void
release_callback(void *buf, size_t length, void *cbdata, bool extra)
{
printf("\trelease callback with %lx, %d\n", (unsigned long) buf, (int) length);
counter--;
}
static int
free_only_test(void)
{
/* BWB - finish me! */
printf("test not written yet - skipping\n");
return 77;
}
static int
alloc_free_test(void)
{
void *foo, *bar;
int retval;
retval = opal_mem_hooks_register_release(release_callback, NULL);
retval |= opal_mem_hooks_register_alloc(alloc_callback, NULL);
if (retval != OMPI_SUCCESS) {
printf("handler registration failed\n");
return retval;
}
/* make some big malloc that should always trip a release on free */
printf(" - malloc big buffer\n");
counter = 0;
foo = malloc(bigsize);
assert(counter >= 1);
printf(" - free of big buffer\n");
counter = 1;
free(foo);
assert(counter == 0);
/* check mmap / munmap */
printf(" - mmap of buffer\n");
counter = 0;
bar = mmap(NULL, 4096, PROT_READ, MAP_ANON, -1, 0);
if (opal_mem_hooks_support_level() & OPAL_MEMORY_MMAP_SUPPORT) {
assert(counter >= 1);
}
printf(" - munmap of buffer\n");
/* mmap might call malloc internally, so do this or we might
appear to leak memory */
counter = 1;
munmap(NULL, 0);
assert(counter == 0);
retval = opal_mem_hooks_unregister_release(release_callback);
retval |= opal_mem_hooks_unregister_alloc(alloc_callback);
return OPAL_SUCCESS;
}
int
main(int argc, char *argv[])
{
int ret;
int support;
if (OPAL_SUCCESS != opal_init()) {
printf("opal failed to init; test failure\n");
exit(1);
}
/* this printf needs to be here for the test to work! */
printf("running malloc hooks test\n");
support = opal_mem_hooks_support_level();
if (0 == support) {
printf("no memory registration supported. skipping test.\n");
ret = 77;
} else if ((OPAL_MEMORY_FREE_SUPPORT|OPAL_MEMORY_MALLOC_SUPPORT) ==
((OPAL_MEMORY_FREE_SUPPORT|OPAL_MEMORY_MALLOC_SUPPORT) & support)) {
ret = alloc_free_test();
} else if (OPAL_MEMORY_FREE_SUPPORT & support) {
ret = free_only_test();
} else {
printf("Odd support response: %d\n", support);
ret = 1;
}
opal_finalize();
return ret;
}

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

@ -1,88 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <vector>
#include <stdio.h>
#include "ompi/constants.h"
#include "opal/runtime/opal.h"
#include "opal/memoryhooks/memory.h"
using namespace std;
int ret = 1;
int size = 10 * 1024 * 1024;
extern "C" {
static void
callback(void *buf, size_t length, void *cbdata, bool extra)
{
printf("\tcallback with %lx, %d\n", (unsigned long) buf, (int) length);
ret--;
}
}
int
main(int argc, char *argv[])
{
int retval;
if (OPAL_SUCCESS != opal_init()) {
printf("opal failed to init; test failure\n");
exit(1);
}
if (0 == ((OPAL_MEMORY_FREE_SUPPORT|OPAL_MEMORY_MALLOC_SUPPORT) &
opal_mem_hooks_support_level())) {
printf("no memory registration supported. skipping\n");
return 77;
}
retval = opal_mem_hooks_register_release(callback, NULL);
if (retval != OMPI_SUCCESS) return retval;
vector<int> *big_vec;
printf(" - allocating big vector\n");
big_vec = new vector<int>;
big_vec->reserve(size);
/* touch all the locations, just to make sure C++ isn't smarter
than I am */
for (int i = 0 ; i < size ; ++i) {
(*big_vec)[i] = i;
}
printf(" - deleting big vector\n");
delete big_vec;
printf(" - all done\n");
retval = opal_mem_hooks_unregister_release(callback);
if (retval != OMPI_SUCCESS) return retval;
opal_finalize();
/* some implementations of delete will call free twice */
if (ret < 0) ret = 0;
return ret;
}

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

@ -1,160 +0,0 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include "ompi/constants.h"
#include "opal/runtime/opal.h"
#include "opal/memoryhooks/memory.h"
#define iters 100000
#define mask 0xfff
static void* ptrs[iters];
static void
callback(void *buf, size_t length, void *cbdata, bool extra)
{
}
int
main(int argc, char *argv[])
{
int i, retval;
struct timeval start, end;
long time;
if (OPAL_SUCCESS != opal_init()) {
printf("opal failed to init; test failure\n");
exit(1);
}
if (0 == ((OPAL_MEMORY_FREE_SUPPORT|OPAL_MEMORY_MALLOC_SUPPORT) &
opal_mem_hooks_support_level())) {
printf("no memory registration supported. skipping\n");
return 77;
}
printf("speed without a handler:\n");
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
/* malloc out a random size */
ptrs[i] = malloc((rand() & mask) + 1);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" malloc: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
free(ptrs[i]);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" free: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
printf("speed with empty handler:\n");
retval = opal_mem_hooks_register_release(callback, NULL);
if (retval != OMPI_SUCCESS) {
printf("handler registration failed\n");
return retval;
}
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
/* malloc out a random size */
ptrs[i] = malloc((rand() & mask) + 1);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" malloc: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
free(ptrs[i]);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" free: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
opal_mem_hooks_unregister_release(callback);
printf("speed without a handler:\n");
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
/* malloc out a random size */
ptrs[i] = malloc((rand() & mask) + 1);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" malloc: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
free(ptrs[i]);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" free: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
printf("speed with empty handler:\n");
retval = opal_mem_hooks_register_release(callback, NULL);
if (retval != OMPI_SUCCESS) {
printf("handler registration failed\n");
return retval;
}
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
/* malloc out a random size */
ptrs[i] = malloc((rand() & mask) + 1);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" malloc: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
gettimeofday(&start, NULL);
for (i = 0 ; i < iters ; ++i) {
free(ptrs[i]);
}
gettimeofday(&end, NULL);
time = ((end.tv_sec - start.tv_sec) * 1000 * 1000) +
(end.tv_usec - start.tv_usec);
printf(" free: %d calls in %ld microseconds. %lf microseconds/call\n",
iters, time, (double) time / iters);
opal_mem_hooks_unregister_release(callback);
opal_finalize();
return 0;
}