From 8cff3131d6bbb4040734cc0395d3c1947b36615b Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sat, 14 Jun 2008 14:01:05 +0000 Subject: [PATCH] Remove memory tests, as they're out of date This commit was SVN r18656. --- configure.ac | 1 - test/Makefile.am | 2 +- test/memory/Makefile.am | 46 --------- test/memory/opal_memory_basic.c | 137 --------------------------- test/memory/opal_memory_cxx.cc | 88 ------------------ test/memory/opal_memory_speed.c | 160 -------------------------------- 6 files changed, 1 insertion(+), 433 deletions(-) delete mode 100644 test/memory/Makefile.am delete mode 100644 test/memory/opal_memory_basic.c delete mode 100644 test/memory/opal_memory_cxx.cc delete mode 100644 test/memory/opal_memory_speed.c diff --git a/configure.ac b/configure.ac index d5237fc262..d3a19505af 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/test/Makefile.am b/test/Makefile.am index 818d9bcfec..e76c9a5091 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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) diff --git a/test/memory/Makefile.am b/test/memory/Makefile.am deleted file mode 100644 index f65c105598..0000000000 --- a/test/memory/Makefile.am +++ /dev/null @@ -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) diff --git a/test/memory/opal_memory_basic.c b/test/memory/opal_memory_basic.c deleted file mode 100644 index 9d307d1c54..0000000000 --- a/test/memory/opal_memory_basic.c +++ /dev/null @@ -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 -#include -#include -#include - -#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; -} diff --git a/test/memory/opal_memory_cxx.cc b/test/memory/opal_memory_cxx.cc deleted file mode 100644 index 1356068066..0000000000 --- a/test/memory/opal_memory_cxx.cc +++ /dev/null @@ -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 -#include - -#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 *big_vec; - - printf(" - allocating big vector\n"); - big_vec = new vector; - - 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; -} diff --git a/test/memory/opal_memory_speed.c b/test/memory/opal_memory_speed.c deleted file mode 100644 index 2c7e3ad5fb..0000000000 --- a/test/memory/opal_memory_speed.c +++ /dev/null @@ -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 -#include -#include - -#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; -}