[Genabel-commits] r1633 - pkg/OmicABELnoMM/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 5 19:40:20 CET 2014


Author: afrank
Date: 2014-03-05 19:40:19 +0100 (Wed, 05 Mar 2014)
New Revision: 1633

Modified:
   pkg/OmicABELnoMM/src/AIOwrapper.cpp
   pkg/OmicABELnoMM/src/Algorithm.cpp
   pkg/OmicABELnoMM/src/Definitions.h
   pkg/OmicABELnoMM/src/Utility.cpp
   pkg/OmicABELnoMM/src/main.cpp
Log:
Various bugs fixed regarding arrays out of bounds with small problem sets.

Modified: pkg/OmicABELnoMM/src/AIOwrapper.cpp
===================================================================
--- pkg/OmicABELnoMM/src/AIOwrapper.cpp	2014-03-05 13:59:35 UTC (rev 1632)
+++ pkg/OmicABELnoMM/src/AIOwrapper.cpp	2014-03-05 18:40:19 UTC (rev 1633)
@@ -118,7 +118,7 @@
 
 void* AIOwrapper::async_io( void *ptr )
 {
-    cout << "async_io\n" << flush;
+    //cout << "async_io\n" << flush;
     type_fileh* Fhandler = (type_fileh *)ptr;
     int size_buff,tmp_y_blockSize,tmp_ar_blockSize;
 
@@ -152,7 +152,7 @@
     else
     {
         //cout << "\nPreping files\n" << flush;
-        fp_Y = fopen("tempY.bin", "rwb");
+        fp_Y = fopen("tempY.bin", "w+b");
         if(fp_Y == 0)
         {
             cout << "Error creating temp File Y " << endl;
@@ -164,18 +164,18 @@
         delete []tempbuff1;
 
 
-        fp_Ar = fopen("tempAR.bin", "rwb");
+        fp_Ar = fopen("tempAR.bin", "w+b");
         if(fp_Ar == 0)
         {
             cout << "Error creating temp File AR "  << endl;
             exit(1);
         }
-        type_precision* tempbuff2 = new type_precision[Fhandler->n*Fhandler->Ar_blockSize];
-        fwrite(tempbuff2, sizeof(type_precision), Fhandler->n*Fhandler->Ar_blockSize, fp_Ar);
+        type_precision* tempbuff2 = new type_precision[Fhandler->n*Fhandler->Ar_blockSize*Fhandler->r];
+        fwrite(tempbuff2, sizeof(type_precision), Fhandler->n*Fhandler->Ar_blockSize*Fhandler->r, fp_Ar);
         //fclose(fp_Ar);
         delete []tempbuff2;
 
-        fp_B = fopen("tempB.bin", "wb");
+        fp_B = fopen("tempB.bin", "w+b");
         if(fp_B == 0)
         {
             cout << "Error setting up temp File B " << endl;
@@ -848,7 +848,7 @@
             cout << "Error creating temp File AL "<< endl;
             exit(1);
         }
-        fwrite(Fhandler->AL, sizeof(type_precision), Fhandler->n*columnsAL, fp_AL);
+        fwrite(Fhandler->AL, sizeof(type_precision), n*columnsAL, fp_AL);
         fclose(fp_AL);
     }
 }

Modified: pkg/OmicABELnoMM/src/Algorithm.cpp
===================================================================
--- pkg/OmicABELnoMM/src/Algorithm.cpp	2014-03-05 13:59:35 UTC (rev 1632)
+++ pkg/OmicABELnoMM/src/Algorithm.cpp	2014-03-05 18:40:19 UTC (rev 1633)
@@ -284,7 +284,7 @@
     {
         matlab_print_matrix("bcomputed", colsA, rhs, res);
         matlab_print_matrix("newsol", colsA, rhs, ynew);
-        printf("\n%%\tnrom: %0.2g", u_norm);
+        //printf("\n%%\tnrom: %0.2g", u_norm);
     }
 
 
@@ -517,7 +517,7 @@
                                                     cpu_freq);
                         assert(info == 0, "POSV");
 
-                        if (ForceCheck)
+                        if (params.ForceCheck)
                         {
                             #pragma omp critical
                             {

Modified: pkg/OmicABELnoMM/src/Definitions.h
===================================================================
--- pkg/OmicABELnoMM/src/Definitions.h	2014-03-05 13:59:35 UTC (rev 1632)
+++ pkg/OmicABELnoMM/src/Definitions.h	2014-03-05 18:40:19 UTC (rev 1633)
@@ -40,10 +40,11 @@
 #include <iostream>
 #include <lapacke.h>
 
-//!SETTINGS
+//!SETTINGS
+
 #define EXTENDEDTEST 0
-#define PRINT 0 //&& 1EXTENDEDTEST
-#define ForceCheck 0 || EXTENDEDTEST
+#define PRINT 0 //&& 1EXTENDEDTEST
+
 #define OUTPUT 0
 
 #define STORAGE_TYPE LAPACK_COL_MAJOR
@@ -159,7 +160,9 @@
     string fnameY;
     string fnameOutB;
 
-    bool doublefileType;
+    bool doublefileType;
+
+    bool ForceCheck;
 };
 
 

Modified: pkg/OmicABELnoMM/src/Utility.cpp
===================================================================
--- pkg/OmicABELnoMM/src/Utility.cpp	2014-03-05 13:59:35 UTC (rev 1632)
+++ pkg/OmicABELnoMM/src/Utility.cpp	2014-03-05 18:40:19 UTC (rev 1633)
@@ -36,7 +36,7 @@
     type_precision* vec = (type_precision*)malloc(size*sizeof(type_precision));
     if(vec==0)
     {
-        printf("\nNot enough RAM! %dMB\n",(int)size*sizeof(type_precision)/1024/1024 );
+       cout << "\nNot enough RAM! " << (int)(size*sizeof(type_precision)/1024/1024) << "MB\n";
         //system("pause");
         exit(1);
     }
@@ -80,7 +80,7 @@
     type_precision* vec = (type_precision*)malloc(size*sizeof(type_precision));
     if(vec==0)
     {
-        printf("\nNot enough RAM! %dMB\n",(int)size*sizeof(type_precision)/1024/1024 );
+        cout << "\nNot enough RAM! " << (int)(size*sizeof(type_precision)/1024/1024) << "MB\n";
         //system("pause");
         exit(1);
     }

Modified: pkg/OmicABELnoMM/src/main.cpp
===================================================================
--- pkg/OmicABELnoMM/src/main.cpp	2014-03-05 13:59:35 UTC (rev 1632)
+++ pkg/OmicABELnoMM/src/main.cpp	2014-03-05 18:40:19 UTC (rev 1633)
@@ -167,7 +167,8 @@
 
 int main(int argc, char *argv[] )
 {
-    struct Settings params;
+    struct Settings params;
+    params.ForceCheck = false;
 
 //    cout << "Using Arguments: ";
 //    for (int i = 0; i < argc; i++)



More information about the Genabel-commits mailing list