#include "sopnamsp.h" #include "machdefs.h" #include #include #include "tarrinit.h" #include "array.h" #include "timing.h" #include "resusage.h" /* Programme de test de vitesse des operations sur TArray */ /* de SOPHYA Reza, Juillet 2004 */ /* Flag a activer pour compiler avec SOPHYA V <= 1.7 */ /* #define VSOP_17 */ int main(int narg, char* arg[]) { SophyaInit(); InitTim(); // Initializing the CPU timer if (narg < 5) { cout << " spar TSel NLoop NRow NCols \n" << " TSel=0/1/2: Option de selection test 7 avec sous-tableaux \n" << " 0: Ne pas faire test 7 (couteux en V <= 1.7) \n" << " 1: Test 7 1ere partie (sans AA.Row(r)*x+BB.Row(r)*y \n" << " 2: Test 7 complet \n" << " NLoop: Nombre d'iterations \n" << " NRow,NCols: Taille de matrices \n" << " Exemple: spar 0 10 800 1000 (Grande taille memoire) \n" << " spar 1 100 80 100 (Petite taille memoire) \n" << endl; return 1; } int ope = atoi(arg[1]); int nloop = atoi(arg[2]); int nr = atoi(arg[3]); int nc = atoi(arg[4]); cout << " ------------------------------------------------- " << endl; cout << " spar = SpeedArray Ope=" << ope << " NLoop= " << nloop << " NR= " << nr << " NC= " << nc << endl; cout << " ------------------------------------------------- " << endl; ResourceUsage res; cout << "(1) Initialisation matrices Ac,Bc,Af,Bf - Random" << endl; Matrix A(nr, nc, BaseArray::CMemoryMapping); Matrix B(nr, nc, BaseArray::CMemoryMapping); Matrix Ac(nr, nc, BaseArray::CMemoryMapping); Matrix Bc(nr, nc, BaseArray::CMemoryMapping); Matrix Af(nr, nc, BaseArray::FortranMemoryMapping); Matrix Bf(nr, nc, BaseArray::CMemoryMapping); A = RandomSequence(RandomSequence::Flat); B = RandomSequence(RandomSequence::Flat); Ac = A; Bc = B; Af = A; Bf = B; PrtTim("(1) ApresInit Ac,Bc,Af,Bf "); cout << res; long nop, noptot; noptot = 0; cout << "(2) Operations de type A *= c , A += B " << endl; Ac = A; Bc = B; Af = A; Bf = B; for(int k=0; kD) " << endl; Ac = A; Bc = B; Af = A; Bf = B; #ifndef VSOP_17 for(int k=0; kD) (KFLOP) = " << nop << endl; noptot += nop; PrtTim(" Apres (6) "); cout << res; // Les operations sur sous-tableaux sont beaucoup trop couteux V <= 1.7 if (ope > 0) { cout << "\n (7) Operations de AA.Row() *= ... " << endl; Ac = A; Bc = B; Af = A; Bf = B; #ifdef VSOP_17 cout << " !!! Operations couteuses en V<=1.7 " << endl; #endif Matrix AA,BB; Vector * vr = new Vector[nr]; for(int k=0; k