Ignore:
Timestamp:
May 6, 2016, 3:06:29 PM (9 years ago)
Author:
meunier
Message:
  • Added several versions of rosenfeld: { SLOW, FAST } x { FEATURES, NO_FEATURES }
  • Added native linux compilation support
  • Added a script to check results natively
  • Started to refactor nrc code
Location:
soft/giet_vm/applications/rosenfeld/include
Files:
2 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/rosenfeld/include/ecc_common.h

    r772 r821  
    66#define _ECC_COMMON_H_
    77
    8 #ifdef __cplusplus
    9 #pragma message ("C++")
    10 extern "C" {
    11 #endif
    12 
    13 //#include <stdio.h>
    14 //#include <stdlib.h>
    15 //#include <math.h>
    16 
    17 //#include "def.h"
    18 //#include "nrc.h"
    19 //#include "util.h"
    20 //#include "palette.h"
     8#include <stdbool.h>
    219
    2210// ------------------------------------------
    2311// -- valeur des parametres des benchmarks --
    2412// ------------------------------------------ 
    25 //#define ENABLE_GLOBAL_PARAM
    26 //#ifdef ENABLE_GLOBAL_PARAM
     13
    2714#define ECC_G0  1
    2815#define ECC_G1 16
     
    207194uint32 mt19937_uint32(uint32 a, uint32 b);
    208195   
    209 BOOL strto_Bool(char *str);
     196bool strto_Bool(char *str);
    210197
    211198void check_no_write(uint32 **T, int i0, int i1, int j0, int j1);
  • soft/giet_vm/applications/rosenfeld/include/ecc_features.h

    r772 r821  
    1616#define __ECC_FEATURES_H__
    1717
    18 #ifdef __cplusplus
    19 extern "C" {
    20 #endif
    21 
    22 #ifdef VERBOSE_PRAGMA
    23 //#pragma message("- include ecc_features.h")
    24 #endif
    25 
    26 #define REGION_STATS1
    27 
    28 //#define REGION_STATS2
    29 //#define REGION_STATS3
    30 //#define REGION_STATS4
    31 
    32 #define Warning
    33 #define Error
     18#if PARMERGE
     19#include <pthread.h>
     20#endif
     21
    3422
    3523// ------------------------------------------------------------------------
     
    4634  uint32  S;
    4735
    48   uint16  x;       // abscisse du centre d'inertie x = Sx / S
    49   uint16  y;       // ordonnee du centre d'inertie y = Sy / S
    50 
    5136  uint32  Sx;
    5237  uint32  Sy;
    53 
    54 #ifdef REGION_STATS2
    55   //uint64  Sx2;
    56   //uint64  Sxy;
    57   //uint64  Sy2;
    58 
    59   //uint32  Mx2;
    60   //uint32  Mxy;
    61   //uint32  My2;
    62 
    63   double teta; // direction principale
    64 #endif
    65 
    66 #ifdef REGION_STATS3
    67   //uint64  Sx3;
    68   //uint64  Sx2y;
    69   //uint64  Sxy2;
    70   //uint64  Sy3;
    71 
    72   //uint64  Mx3;
    73   //uint64  Mx2y;
    74   //uint64  Mxy2;
    75   //uint64  My3;
    76 #endif
     38#if PARMERGE
     39  pthread_spinlock_t lock;
     40#endif
     41
    7742} RegionStats;
    7843
     
    11277 */
    11378
     79
     80
    11481/* ------------------------------ */
    11582/* --- RegionStats after 2009 --- */
     
    11885
    11986RegionStats* RegionStatsVector                 (int i0, int i1);
     87#if TARGET_OS == GIETVM
     88RegionStats * remote_RegionStatsVector         (int i0, int i1, int x, int y);
     89#endif
    12090RegionStats* RegionStatsVector0                (int i0, int i1);
    12191void    free_RegionStatsVector (RegionStats *v, int i0, int i1);
     
    219189   
    220190void RegionStats_Save_Stats1_Sparse(RegionStats *Stats, uint32 *EQ, uint32 ne0, uint32 ne1, char *filename);
    221 void RegionStats_DisplayStats_Sparse(uint32 *EQ, uint32 ne0, uint32 ne1, RegionStats *Stats, char *name);
     191void RegionStats_DisplayStats_Sparse(uint32 *EQ, uint32 ne0, uint32 ne1, RegionStats *Stats, char *name, int * start_index);
    222192// affichage des Stats pour les etiquettes roots/ancetres de leur composante (pour algo Suzuki)
    223193
     
    235205void sortv_ui32matrix_col(uint32 **m, int i0, int i1, int j0, int j1, int col);
    236206void RegionStats_SortFeatures(RegionStats *Stats, uint32 nemax);
    237    
    238 // version paralleles avec OpenMP2 ou OpenMP4
    239 void imageFeaturesComputation_omp0(uint32 **E, int height, int width, RegionStats *Stats); // wrong
    240 void imageFeaturesComputation_omp2(uint32 **E, int height, int width, RegionStats *Stats); // OpenMP 2.0 critical
    241 void imageFeaturesComputation_omp3(uint32 **E, int height, int width, RegionStats *Stats); // OpenMP 2.0 critical + atomic
    242 void imageFeaturesComputation_omp4(uint32 **E, int height, int width, RegionStats *Stats); // OpenMP 3.0 task + OpenMP 4.0 depend
    243 void imageFeaturesComputation_omp5(uint32 **E, int height, int width, uint16* Xmin, uint16* Xmax, uint16* Ymin, uint16* Ymax, uint32* S, uint32* Sx, uint32* Sy);
    244    
     207
    245208int RegionStats_Compare(RegionStats *S1, RegionStats *S2);
    246209int RegionStatsVector_Compare(RegionStats *S1, int i0, int i1, RegionStats *S2);
  • soft/giet_vm/applications/rosenfeld/include/mca.h

    r805 r821  
    1414#define __MCA_H__
    1515
    16 #include <user_lock.h>
     16#include "ecc_features.h"
     17
     18#include "nrc_os_config.h"
     19
     20#if TARGET_OS == GIETVM
     21    #include <user_lock.h>
     22    #include <user_barrier.h>
     23#elif TARGET_OS == LINUX
     24    #include <pthread.h>
     25#endif
    1726
    1827
    19 #ifdef __cplusplus
    20 #ifdef VERBOSE_PRAGMA
    21 #pragma message ("C++")
    22 #endif
    23 extern "C" {
    24 #endif
     28// QM : using mutex lock instead of mutexlock,
     29// because apparently mutexlocks cause a bug in valgrind
     30// (solved but the installed version is not recent enough)
     31// cf. https://bugs.kde.org/show_bug.cgi?id=336435
     32pthread_mutex_t print_lock;
    2533
    26 user_lock_t print_lock;
    27 
    28 #define MCA_VERBOSE0(X) ({         \
    29         lock_acquire(&print_lock); \
    30         X;                         \
    31         lock_release(&print_lock); \
     34#define MCA_VERBOSE0(X) ({                 \
     35        pthread_mutex_lock(&print_lock);   \
     36        X;                                 \
     37        pthread_mutex_unlock(&print_lock); \
    3238        })
    33 #define MCA_VERBOSE1(X) ({         \
    34         lock_acquire(&print_lock); \
    35         X;                         \
    36         lock_release(&print_lock); \
     39#define MCA_VERBOSE1(X) ({                 \
     40        pthread_mutex_lock(&print_lock);   \
     41        X;                                 \
     42        pthread_mutex_unlock(&print_lock); \
     43        })
     44#define MCA_DISPLAY0(X) ({                 \
     45        pthread_mutex_lock(&print_lock);   \
     46        X;                                 \
     47        pthread_mutex_unlock(&print_lock); \
     48        })
     49#define MCA_DISPLAY1(X) ({                 \
     50        pthread_mutex_lock(&print_lock);   \
     51        X;                                 \
     52        pthread_mutex_unlock(&print_lock); \
    3753        })
    3854
    3955
    40 //#define MCA_VERBOSE2(X) X
    41 #define MCA_VERBOSE2(X)
     56#define MCA_VERBOSE2(X)
     57/*
     58#define MCA_VERBOSE2(X) ({                 \
     59        pthread_mutex_lock(&print_lock);   \
     60        X;                                 \
     61        pthread_mutex_unlock(&print_lock); \
     62        })
     63*/
     64
     65#define MCA_DISPLAY2(X)
    4266
    4367
     
    5680   
    5781    uint32 e0, e1; // indice pour chaque bande
    58     uint32 ne; // indice max d'etiquettes utilise par bande
     82    uint32 ne;     // indice max d'etiquettes utilise par bande
    5983
    60     int alpha; // puissance de 2 >= a la taille d'un bloc
    61     //uint32 *I;
    62     uint32  *T; // table d'quivalence table (Rosenfeld) ou d'indices (Warp)
    63     uint32 **D; // distributed table (instanciee dans chaque worker)
     84    int alpha;     // puissance de 2 >= a la taille d'un bloc
     85    uint32  * T;   // table d'quivalence table (Rosenfeld) ou d'indices (Warp)
     86    uint32 ** D;   // distributed table (instanciee dans chaque worker)
    6487   
    65     //RegionStats *Stats;
     88    RegionStats * stats;
     89    RegionStats ** F;
    6690   
    6791    struct sMCA * mca;   // pointeur vers le maitre (pour les esclaves)
    6892    struct sMCA ** mcas; // tableau de pointeurs vers les workers
     93
     94    // For pyramidal barriers
     95    int nb_level;
     96    pthread_barrier_t * barriers;
    6997} MCA;
    70     
     98 
    7199void MCA_Error(char * msg);
    72100
     
    77105void MCA_Set_ImageL(MCA * mca, uint32 ** E);
    78106
    79 void   MCA_Set_Size(MCA * mca, int width, int height);
    80 void   MCA_Set_NP(MCA * mca, int np);
     107void MCA_Set_Size(MCA * mca, int width, int height);
     108void MCA_Set_NP(MCA * mca, int np);
    81109
    82110uint32 MCA_CalcMaxLabels(int connection, uint32 height, uint32 width);
     
    99127void MCA_Warp(MCA * mca);
    100128
    101 #ifdef __cplusplus
    102 }
    103 #endif
    104129
    105130#endif // __MCA_H__
  • soft/giet_vm/applications/rosenfeld/include/mca_matrix_dist.h

    r805 r821  
    1313uint32 ** dist_ui32matrix(int i0, int i1, int j0, int j1);
    1414void free_dist_ui32matrix(uint32 ** m, int i0, int i1, int j0, int j1);
     15#if TARGET_OS == GIETVM
     16uint32 ** remote_dist_ui32matrix(int i0, int i1, int j0, int j1, int x, int y);
     17#endif
    1518
    1619#ifdef __cplusplus
  • soft/giet_vm/applications/rosenfeld/include/mca_rosenfeld.h

    r805 r821  
    1616#include "mca.h"
    1717
    18 #ifdef __cplusplus
    19 #ifdef VERBOSE_PRAGMA
    20 #pragma message ("C++")
    21 #endif
    22 extern "C" {
    23 #endif
    24 
    2518uint32 line0Labeling_Rosenfeld  (uint8 ** X, int i, int width, uint32 ** E, uint32 * T, uint32 ne);
    2619uint32 lineLabeling_DT_Rosenfeld(uint8 ** X, int i, int width, uint32 ** E, uint32 * T, uint32 ne);
     
    2922void   solveTable_Range_Rosenfeld(uint32 * T, uint32 e0, uint32 e1);
    3023
    31 void MCA_Label_Rosenfeld(MCA * mca);
     24void * MCA_Label_Rosenfeld(void * arg);
     25void * MCA_Label_Features_Rosenfeld(void * arg);
    3226   
    33 #ifdef __cplusplus
    34 }
    35 #endif
    36 
    3727#endif // __MCA_ROSENFELD_H__
    3828
Note: See TracChangeset for help on using the changeset viewer.