[Genabel-commits] r1861 - in pkg/OmicABELnoMM: examples src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 28 11:20:35 CET 2014
Author: afrank
Date: 2014-10-28 11:20:35 +0100 (Tue, 28 Oct 2014)
New Revision: 1861
Modified:
pkg/OmicABELnoMM/examples/exclude_individuals.txt
pkg/OmicABELnoMM/src/AIOwrapper.cpp
pkg/OmicABELnoMM/src/Utility.cpp
pkg/OmicABELnoMM/src/Utility.h
Log:
More code cleanup around unused fakefile feature.
Modified: pkg/OmicABELnoMM/examples/exclude_individuals.txt
===================================================================
--- pkg/OmicABELnoMM/examples/exclude_individuals.txt 2014-10-28 09:59:23 UTC (rev 1860)
+++ pkg/OmicABELnoMM/examples/exclude_individuals.txt 2014-10-28 10:20:35 UTC (rev 1861)
@@ -2,4 +2,4 @@
5
7
9 11
-10
\ No newline at end of file
+13
\ No newline at end of file
Modified: pkg/OmicABELnoMM/src/AIOwrapper.cpp
===================================================================
--- pkg/OmicABELnoMM/src/AIOwrapper.cpp 2014-10-28 09:59:23 UTC (rev 1860)
+++ pkg/OmicABELnoMM/src/AIOwrapper.cpp 2014-10-28 10:20:35 UTC (rev 1861)
@@ -200,7 +200,7 @@
}
else
{
- //other params come from outside
+ //no longer used
}
params.mb = min(params.m,params.mb);
@@ -791,7 +791,7 @@
{
//cout << "async_io\n" << flush;
type_fileh* Fhandler = (type_fileh *)ptr;
- int size_buff,tmp_y_blockSize,tmp_ar_blockSize;
+ int tmp_y_blockSize,tmp_ar_blockSize;
struct timespec timeToWait;
FILE* fp_Y;
@@ -967,7 +967,6 @@
tmp_y_blockSize = Fhandler->y_to_readSize;
Fhandler->y_to_readSize -= tmp_y_blockSize;
- size_buff = Fhandler->n * tmp_y_blockSize;
@@ -983,14 +982,7 @@
if(Fhandler->fakefiles)
{
- fseek ( fp_Y , 0 , SEEK_SET );
- size_t result = fread (tobeFilled->buff,sizeof(type_precision),size_buff,fp_Y);
- result++;
- int old_seed = Fhandler->seed;
- srand (old_seed);
- re_random_vec(tobeFilled->buff, size_buff );
- re_random_vec_nan(tobeFilled->buff, size_buff );
- Fhandler->seed += 75;
+ //no longer used
}
else
{
@@ -1052,7 +1044,6 @@
#endif
Fhandler->Ar_to_readSize -= tmp_ar_blockSize;
- size_buff = Fhandler->n * tmp_ar_blockSize*Fhandler->r;
pthread_mutex_lock(&(Fhandler->m_buff_upd));
type_buffElement* tobeFilled = Fhandler->ar_empty_buffers.front();
@@ -1066,12 +1057,7 @@
if(Fhandler->fakefiles)
{
-// fp_Ar.seekg ( 0 , ios::beg );
-// fp_Ar.read ((char*)tobeFilled->buff,sizeof(type_precision)*size_buff);
-//
-// re_random_vec(tobeFilled->buff , Fhandler->n * tmp_ar_blockSize*Fhandler->r );
-// re_random_vec_nan(tobeFilled->buff , Fhandler->n * tmp_ar_blockSize*Fhandler->r );
-
+ //no longer used
}
else
{
@@ -1292,11 +1278,7 @@
Fhandler->write_full_buffers.pop();
- if(Fhandler->fakefiles)
- {
- }
-
if(!Fhandler->fakefiles && !tobeWritten->empty())
{
@@ -2001,62 +1983,39 @@
void AIOwrapper::load_AL(type_precision** AL)
{
- if(Fhandler->fakefiles)
- {
- FILE *fp;
- fp = fopen("tempAL.bin", "rb");
- if(fp == 0)
- {
- cout << "Error Reading File tempAL.bin" << endl;
- exit(1);
- }
- size_t result = fread (Fhandler->AL,sizeof(type_precision),Fhandler->l*Fhandler->n,fp);
- result++;
- fclose(fp);
- srand(22);
- re_random_vec(Fhandler->AL,Fhandler->n*Fhandler->l);
- re_random_vec_nan(Fhandler->AL,Fhandler->n*Fhandler->l);
- (*AL) = Fhandler->AL;
- }
- else
+ FILE *fp;
+ fp = fopen((Fhandler->fnameAL+".fvd").c_str(), "rb");
+ if(fp == 0)
{
- FILE *fp;
- fp = fopen((Fhandler->fnameAL+".fvd").c_str(), "rb");
- if(fp == 0)
- {
- cout << "Error Reading File " << Fhandler->fnameAL << endl;
- exit(1);
- }
+ cout << "Error Reading File " << Fhandler->fnameAL << endl;
+ exit(1);
+ }
- list< pair<int,int> >* excl_List = Fhandler->excl_List;
+ list< pair<int,int> >* excl_List = Fhandler->excl_List;
- int chunk_size_buff;
- int buff_pos=0;
- int file_pos;
+ int chunk_size_buff;
+ int buff_pos=0;
+ int file_pos;
- for (int i=0; i < Fhandler->l; i++)
+ for (int i=0; i < Fhandler->l; i++)
+ {
+ for (list< pair<int,int> >::iterator it=excl_List->begin(); it != excl_List->end(); ++it)
{
- for (list< pair<int,int> >::iterator it=excl_List->begin(); it != excl_List->end(); ++it)
- {
- file_pos = i*Fhandler->fileN+ it->first;
- fseek ( fp , file_pos*sizeof(type_precision) , SEEK_SET );
- chunk_size_buff = it->second;
+ file_pos = i*Fhandler->fileN+ it->first;
+ fseek ( fp , file_pos*sizeof(type_precision) , SEEK_SET );
+ chunk_size_buff = it->second;
- size_t result = fread (&(Fhandler->AL[buff_pos]),sizeof(type_precision),chunk_size_buff,fp); result++;
- buff_pos += chunk_size_buff;
- }
+ size_t result = fread (&(Fhandler->AL[buff_pos]),sizeof(type_precision),chunk_size_buff,fp); result++;
+ buff_pos += chunk_size_buff;
}
+ }
- //cout << Fhandler->n;
+ //cout << Fhandler->n;
+ fclose(fp);
-// size_t result = fread (Fhandler->AL,sizeof(type_precision),Fhandler->l*Fhandler->n,fp);
-//
-// result++;
- fclose(fp);
- }
@@ -2070,17 +2029,6 @@
Fhandler->AL = new type_precision[columnsAL*n];
Fhandler->l=columnsAL;
- if(Fhandler->fakefiles)
- {
- FILE* fp_AL = fopen("tempAL.bin", "w+b");
- if(fp_AL == 0)
- {
- cout << "Error creating temp File AL "<< endl;
- exit(1);
- }
- fwrite(Fhandler->AL, sizeof(type_precision), n*columnsAL, fp_AL);
- fclose(fp_AL);
- }
}
void AIOwrapper::finalize_AL()
Modified: pkg/OmicABELnoMM/src/Utility.cpp
===================================================================
--- pkg/OmicABELnoMM/src/Utility.cpp 2014-10-28 09:59:23 UTC (rev 1860)
+++ pkg/OmicABELnoMM/src/Utility.cpp 2014-10-28 10:20:35 UTC (rev 1861)
@@ -28,28 +28,9 @@
}
-type_precision* random_vec(int size)
-{
- type_precision* vec =
- (type_precision*)malloc(size * sizeof(type_precision));
- if (vec == 0)
- {
- cout << "\nNot enough RAM! "
- << (int)(size*sizeof(type_precision)/1024/1024) << "MB\n";
- //system("pause");
- exit(1);
- }
- for (int i = 0; i < size; i++)
- {
- vec[i] = (type_precision)rand() / (type_precision)RAND_MAX;
- }
- return vec;
-}
-
-
void re_random_vec(type_precision* vec, int size)
{
for (int i = 0; i < size; i++)
@@ -59,25 +40,9 @@
}
-void re_random_vec_nan(type_precision* vec, int size)
-{
- //int i;
-// for ( i = 0; i < size; i++)
-// {
-// if ((type_precision)rand() / (type_precision)RAND_MAX > 0.5)
-// vec[i] = nanf("");
-// }
-}
-//no allocation!
-//inline void inlinecopy_vec(type_precision*old, type_precision* new_vec, int size)
-//{
-// memcpy( (type_precision*)new_vec, (type_precision*)old, size * sizeof(type_precision) );
-//}
-
-
type_precision* replicate_vec(type_precision* old, int size)
{
type_precision* vec =
@@ -240,46 +205,6 @@
}
}
-
-void cpu_benchmark(int n, int samples, double &duration, double &GFLOPS)
-{
- type_precision* A = new type_precision[n * n];
- type_precision* B = new type_precision[n * n];
- type_precision* C = new type_precision[n * n];
-
- cputime_type start_tick, end_tick;
- duration = 9999999999.0;
- int b = 0;
-
- for (int i = 0; i < samples; i++)
- {
- re_random_vec(A, n*n);
- re_random_vec(B, n*n);
- re_random_vec(C, n*n);
-
- get_ticks(start_tick);
- cblas_sgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, n, n, n,
- 1.0, A, n, B, n, 1.0, C, n);
- get_ticks(end_tick);
- duration = min(duration, (double)(ticks2sec(end_tick, start_tick)));
- int a = 0;
- for (int j = 0; j < n * n ; j++)
- {
- a += A[j] + B[j] + C[j];
- }
- b += a;
- }
- //!2nnn - nn + 2nn (from+c)
- GFLOPS = gemm_flops(n, n, n, 0);
-
- cout << b;
-
- delete []A;
- delete []B;
- delete []C;
-}
-
-
float getTvalue(float pval)
{
// cout << pval << endl;
Modified: pkg/OmicABELnoMM/src/Utility.h
===================================================================
--- pkg/OmicABELnoMM/src/Utility.h 2014-10-28 09:59:23 UTC (rev 1860)
+++ pkg/OmicABELnoMM/src/Utility.h 2014-10-28 10:20:35 UTC (rev 1861)
@@ -25,10 +25,7 @@
type_precision* replicate_vec(type_precision*old, int size);
void matlab_print_matrix(string name, int m, int n, type_precision* A);
-void cpu_benchmark(int n, int samples, double &duration, double &gflops);
-void re_random_vec_nan(type_precision* vec, int size);
-
void replace_with_zeros(list<long int>* indexs, type_precision* vec,
int n, int r, int block_count);
More information about the Genabel-commits
mailing list