[llvm-commits] CVS: llvm-test/MultiSource/Applications/viterbi/Makefile dec_viterbi_F.c read_dmatrix.c test.c

Bill Wendling isanbard at gmail.com
Tue Oct 3 18:31:35 CDT 2006



Changes in directory llvm-test/MultiSource/Applications/viterbi:

Makefile updated: 1.1 -> 1.2
dec_viterbi_F.c updated: 1.1 -> 1.2
read_dmatrix.c updated: 1.1 -> 1.2
test.c updated: 1.1 -> 1.2
---
Log message:

Modified code so that it accepts a flag indicating where the data input
file is. Also changed so that the double floating points are printed
correctly.

Also changed so that time stamps aren't shown. This leads to "false
negatives".


---
Diffs of the changes:  (+46 -31)

 Makefile        |    4 +---
 dec_viterbi_F.c |   17 ++++++++++++++++-
 read_dmatrix.c  |   50 +++++++++++++++++++++++++-------------------------
 test.c          |    6 ++++--
 4 files changed, 46 insertions(+), 31 deletions(-)


Index: llvm-test/MultiSource/Applications/viterbi/Makefile
diff -u llvm-test/MultiSource/Applications/viterbi/Makefile:1.1 llvm-test/MultiSource/Applications/viterbi/Makefile:1.2
--- llvm-test/MultiSource/Applications/viterbi/Makefile:1.1	Tue Oct  3 17:05:26 2006
+++ llvm-test/MultiSource/Applications/viterbi/Makefile	Tue Oct  3 18:31:21 2006
@@ -1,9 +1,7 @@
 LEVEL = ../../..
 PROG = viterbi
 
-CPPFLAGS = -I$(PROJ_SRC_DIR)
+CPPFLAGS = -I$(PROJ_SRC_DIR) -DPROJ_SRC_DIR=\"$(PROJ_SRC_DIR)\"
 LDFLAGS  =
 
-###RUN_OPTIONS="$(PROJ_SRC_DIR)/Dist_demux"
-
 include ../../Makefile.multisrc


Index: llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c
diff -u llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.1 llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.2
--- llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.1	Tue Oct  3 17:05:26 2006
+++ llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c	Tue Oct  3 18:31:21 2006
@@ -11,7 +11,12 @@
   char X0, X1, Y0, Y1;
   unsigned char history[MAX_Nways][MAX_history];
   unsigned char history_new[MAX_Nways][MAX_history+1];
+#if 0
+  /* FIXME */
+  /* Time varies between runs giving false negatives about which run
+     (JIT, CBE, or LLC) failed */
   double startTime, now, estTotal;
+#endif /* 0 */
   
   if (bit_stream->length) {
     bitvector_clear(bit_stream);
@@ -30,16 +35,26 @@
   memcpy(Metr, Metr_mem->data, Metr_mem->length*sizeof(double));
   memcpy(history, history_mem, sizeof(history));
   
+#if 0
+  /* FIXME */
+  /* Time varies between runs giving false negatives about which run
+     (JIT, CBE, or LLC) failed */
   startTime = sTime();
+#endif /* 0 */
   i_punct = 0;
   while (i_in<bit_stream->length) {
+#if 0
+    /* FIXME */
+    /* Time varies between runs giving false negatives about which run
+       (JIT, CBE, or LLC) failed */
     if (i_in && (i_in % 10000 == 0)) {
       now = sTime();
       estTotal = ((double)1.02*bit_stream->length/((double)i_in))*(now-startTime);
-      printf("Viterbi: Estimate %1.1lf%% complete (%1.1lf seconds / %1.1lf seconds)...\r",
+      printf("Viterbi: Estimate %1.1lf%% complete (%1.1lf seconds / %1.1lf seconds)...\n",
              (double)100.0*i_in/(1.02*bit_stream->length), now-startTime, estTotal);
       fflush(stdout);
     }
+#endif /* 0 */
     if (i_punct == param->n_in) {
       i_punct = 0;                 
     }


Index: llvm-test/MultiSource/Applications/viterbi/read_dmatrix.c
diff -u llvm-test/MultiSource/Applications/viterbi/read_dmatrix.c:1.1 llvm-test/MultiSource/Applications/viterbi/read_dmatrix.c:1.2
--- llvm-test/MultiSource/Applications/viterbi/read_dmatrix.c:1.1	Tue Oct  3 17:05:26 2006
+++ llvm-test/MultiSource/Applications/viterbi/read_dmatrix.c	Tue Oct  3 18:31:21 2006
@@ -1,28 +1,28 @@
 #include <stdio.h>
 #include <memory.h>
 
-#include "common.h"
-
-size_t read_dmatrix(dvarray* out, const char* filename) {
-    FILE* fid = fopen(filename,"rt");
-    double value;
-    size_t i, j, width = 0, height = 0;
-
-    printf("Opened file %s for matrix reading\n", filename);
-
-    fscanf(fid, "%d %d\n", &height, &width);
-
-    dvarray_init(out, height, width);
-    
-    for (i=0; i<height; ++i) {
-      for (j=0; j<width; ++j) {
-        fscanf(fid,"%lf\n",&value);
-          out->data[i].data[j] = value;
-      }
-    }
-
-    printf("%lf\n", out->data[i-1].data[j-1]);
-    fclose(fid);
-    printf("File read and closed\n");
-    return i*j;
-}
+#include "common.h"
+
+size_t read_dmatrix(dvarray* out, const char* filename) {
+    FILE* fid = fopen(filename,"rt");
+    double value;
+    size_t i, j, width = 0, height = 0;
+
+    printf("Opened file %s for matrix reading\n", filename);
+
+    fscanf(fid, "%d %d", &height, &width);
+
+    dvarray_init(out, height, width);
+
+    for (i=0; i<height; ++i) {
+      for (j=0; j<width; ++j) {
+        fscanf(fid,"%lf",&value);
+        out->data[i].data[j] = value;
+      }
+    }
+
+    printf("%g\n", out->data[i-1].data[j-1]);
+    fclose(fid);
+    printf("File read and closed\n");
+    return i*j;
+}


Index: llvm-test/MultiSource/Applications/viterbi/test.c
diff -u llvm-test/MultiSource/Applications/viterbi/test.c:1.1 llvm-test/MultiSource/Applications/viterbi/test.c:1.2
--- llvm-test/MultiSource/Applications/viterbi/test.c:1.1	Tue Oct  3 17:05:26 2006
+++ llvm-test/MultiSource/Applications/viterbi/test.c	Tue Oct  3 18:31:21 2006
@@ -3,6 +3,8 @@
 
 #include "common.h"
 
+#define INPUT_FILE PROJ_SRC_DIR "/Dist_demux"
+
 size_t read_dmatrix(dvarray* out, const char* filename);
 void dec_viterbi_F(dvector* Metr_mem, unsigned char* history_mem, bitvector* bit_stream,
                    const dvarray* Dist, const param_viterbi_t* param, size_t n);
@@ -25,11 +27,11 @@
   dvector_init(&Metr_mem, MAX_Nways);
   memcpy(Metr_mem.data, param_viterbi.Metr, sizeof(param_viterbi.Metr));
 
-  read_dmatrix(&Dist_demux, "Dist_demux");
+  read_dmatrix(&Dist_demux, INPUT_FILE);
 
   printf("Starting Viterbi\n");
   dec_viterbi_F(&Metr_mem, history_mem, &d_bit_stream, &Dist_demux, &param_viterbi, 0);
-  printf("\nViterbi finished\n");
+  printf("Viterbi finished\n");
 
   dvector_clear(&Metr_mem);
   dvarray_clear(&Dist_demux);






More information about the llvm-commits mailing list