[test-suite] r251899 - consumer-typeset: Avoid writing and re-reading temporary files

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 20:04:27 PST 2015


Author: matze
Date: Mon Nov  2 22:04:27 2015
New Revision: 251899

URL: http://llvm.org/viewvc/llvm-project?rev=251899&view=rev
Log:
consumer-typeset: Avoid writing and re-reading temporary files

- Writing/Reading files is not a good idea for a compiler/CPU benchmark;
  It easily adds noise to the results depending on filesystem behaviour.
- We can avoid complicated Makefile rules in this case (and I don't have
  to fix the rules in CMakeLists.txt which are broken for me)

Modified:
    test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile
    test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/z36.c

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/CMakeLists.txt?rev=251899&r1=251898&r2=251899&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/CMakeLists.txt Mon Nov  2 22:04:27 2015
@@ -7,26 +7,8 @@ set(LEVEL ../../../..)
 set(PROG consumer-typeset)
 set(CPPFLAGS -DOS_UNIX=1 -DOS_DOS=0 -DOS_MAC=0 -DDB_FIX=0 -DUSE_STAT=1 -DSAFE_DFT=0 -DCOLLATE=1 -DLIB_DIR=\\"lout.lib\\" -DFONT_DIR=\\"font\\" -DMAPS_DIR=\\"maps\\" -DINCL_DIR=\\"include\\" -DDATA_DIR=\\"data\\" -DHYPH_DIR=\\"hyph\\" -DLOCALE_DIR=\\"locale\\" -DCHAR_IN=1 -DCHAR_OUT=0 -DLOCALE_ON=1 -DASSERT_ON=1 -DDEBUG_ON=0  -DPDF_COMPRESSION=0 -D_FORTIFY_SOURCE=0)
 set(LDFLAGS -lm)
-set(RUN_OPTIONS -x -I ${CMAKE_CURRENT_SOURCE_DIR}/data/include -D ${CMAKE_CURRENT_SOURCE_DIR}/data/data -F ${CMAKE_CURRENT_SOURCE_DIR}/data/font -C ${CMAKE_CURRENT_SOURCE_DIR}/data/maps -H ${CMAKE_CURRENT_BINARY_DIR}/data/hyph ${CMAKE_CURRENT_SOURCE_DIR}/large.lout)
-set(GeneratedTestInputs copy-hyph-files)
+set(RUN_OPTIONS -x -I ${CMAKE_CURRENT_SOURCE_DIR}/data/include -D ${CMAKE_CURRENT_SOURCE_DIR}/data/data -F ${CMAKE_CURRENT_SOURCE_DIR}/data/font -C ${CMAKE_CURRENT_SOURCE_DIR}/data/maps -H ${CMAKE_CURRENT_SOURCE_DIR}/data/hyph ${CMAKE_CURRENT_SOURCE_DIR}/large.lout)
 
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/hyph/${file}
-      COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/data/hyph
-      COMMENT "Making directory for consumer-typeset test inputs")
+llvm_multisource()
 
-file(GLOB test_data "${CMAKE_CURRENT_SOURCE_DIR}/data/hyph/*")
-foreach(file ${test_data})
-  add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/hyph/${file}
-      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/data/hyph
-      COMMAND cp -r ${file} ${CMAKE_CURRENT_BINARY_DIR}/data/hyph/
-      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-      COMMENT "Copying consumer-typeset test inputs")
-  list(APPEND test_files ${file})
-endforeach()
-
-add_custom_target(consumer-typeset_input SOURCES ${test_files})
-    llvm_multisource()
-
-#set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${test_files})
-add_dependencies(consumer-typeset consumer-typeset_input)
 llvm_add_subdirectories(${DIRS} ${PARALLEL_DIRS})

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile?rev=251899&r1=251898&r2=251899&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/Makefile Mon Nov  2 22:04:27 2015
@@ -5,20 +5,6 @@ PROG     = consumer-typeset
 # point in this program and FORIFY implementations rely on the correct type.
 CPPFLAGS = -DOS_UNIX=1 -DOS_DOS=0 -DOS_MAC=0 -DDB_FIX=0 -DUSE_STAT=1 -DSAFE_DFT=0 -DCOLLATE=1 -DLIB_DIR=\"lout.lib\" -DFONT_DIR=\"font\" -DMAPS_DIR=\"maps\" -DINCL_DIR=\"include\" -DDATA_DIR=\"data\" -DHYPH_DIR=\"hyph\" -DLOCALE_DIR=\"locale\" -DCHAR_IN=1 -DCHAR_OUT=0 -DLOCALE_ON=1 -DASSERT_ON=1 -DDEBUG_ON=0  -DPDF_COMPRESSION=0 -D_FORTIFY_SOURCE=0
 LDFLAGS  = -lm
-RUN_OPTIONS = -x -I $(PROJ_SRC_DIR)/data/include -D $(PROJ_SRC_DIR)/data/data -F $(PROJ_SRC_DIR)/data/font -C $(PROJ_SRC_DIR)/data/maps -H $(PROJ_OBJ_DIR)/data/hyph $(PROJ_SRC_DIR)/large.lout
-
-# The consumer-typeset benchmark wants to write output files (caches derived
-# from the inputs, I think) into the same dir as the hyphenation files. In order
-# to avoid writing back into the source directory, we copy the hyphenation files
-# into the output directory.
-GeneratedTestInputs := copy-hyph-files
+RUN_OPTIONS = -x -I $(PROJ_SRC_DIR)/data/include -D $(PROJ_SRC_DIR)/data/data -F $(PROJ_SRC_DIR)/data/font -C $(PROJ_SRC_DIR)/data/maps -H $(PROJ_SRC_DIR)/data/hyph $(PROJ_SRC_DIR)/large.lout
 
 include $(LEVEL)/MultiSource/Makefile.multisrc
-
-copy-hyph-files:
-	if [ ! $(PROJ_SRC_DIR) = $(PROJ_OBJ_DIR) ]; \
-	then \
-	  mkdir -p  $(PROJ_OBJ_DIR)/data/hyph/; \
-	  cp $(PROJ_SRC_DIR)/data/hyph/* $(PROJ_OBJ_DIR)/data/hyph/; \
-	fi
-.PHONY: copy-hyph-files

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/z36.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/z36.c?rev=251899&r1=251898&r2=251899&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/z36.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/z36.c Mon Nov  2 22:04:27 2015
@@ -910,6 +910,8 @@ static TRIE TrieRead(LANGUAGE_NUM lnum,
     fclose(unpacked_fp);
     CompressTrie(T);
 
+    /* Avoid writing and re-reading a cache file in benchmarking mode */
+#if 0
     /* write the compressed trie out to the packed file */
     /* cannot use FileName(packed_fnum) because path won't be right */
     StringCopy(buff, FileName(unpacked_fnum));
@@ -941,8 +943,10 @@ static TRIE TrieRead(LANGUAGE_NUM lnum,
     if( packed_fp == NULL )
       Error(36, 15, "cannot open hyphenation file %s",
 	FATAL, no_fpos, FileName(packed_fnum));
+#endif
   } /* end if( packed_fp == NULL ) */
 
+#if 0
   /* now packed hyphenation file is open, read it in */
   fseek(packed_fp, 0L, SEEK_END);
   len = (unsigned) ftell(packed_fp); rewind(packed_fp);
@@ -971,6 +975,7 @@ static TRIE TrieRead(LANGUAGE_NUM lnum,
   for( i = 0; i < T->node_free; i++ )  BeGetShort(packed_fp, &T->node_mem[i]);
   for( i = 0; i < T->string_lim; i++ ) BeGetChar(packed_fp, &T->string_mem[i]);
   fclose(packed_fp);
+#endif
 
   /* debug and exit */
   debug0(DHY, DD, "TrieRead returning, T =");




More information about the llvm-commits mailing list