Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into fix/execute_benched
[simgrid.git] / examples / smpi / NAS / dt.c
index 341eaa2..c98a0d3 100644 (file)
@@ -1,10 +1,10 @@
 /*************************************************************************
- *                                                                       * 
+ *                                                                       *
  *    N  A  S   P A R A L L E L   B E N C H M A R K S  3.3     *
  *                                     *
  *                  D T       *
  *                                     *
- ************************************************************************* 
+ *************************************************************************
  *                                     *
  *   This benchmark is part of the NAS Parallel Benchmark 3.3 suite.   *
  *                                     *
@@ -31,7 +31,7 @@
  *     E-mail:  npb@nas.nasa.gov                   *
  *     Fax:   (650) 604-3957                     *
  *                                     *
- ************************************************************************* 
+ *************************************************************************
  *                                     *
  *   Author: M. Frumkin         *       *
  *                                     *
@@ -180,14 +180,14 @@ static DGraph *buildSH(const char cls){
   tmpS>>=1;
   }
   for(i=0;i<numSources;i++){
-  snprintf(nm,BLOCK_SIZE,"Source.%d",i);
-  nd=newNode(nm);
-  AttachNode(dg,nd);
+    snprintf(nm, BLOCK_SIZE, "Source.%u", i);
+    nd = newNode(nm);
+    AttachNode(dg, nd);
   }
   for(j=0;j<numOfLayers;j++){
     mask=0x00000001<<j;
     for(i=0;i<numSources;i++){
-      snprintf(nm,BLOCK_SIZE,"Comparator.%d",(i+j*firstLayerNode));
+      snprintf(nm, BLOCK_SIZE, "Comparator.%u", (i + j * firstLayerNode));
       nd=newNode(nm);
       AttachNode(dg,nd);
       ndoff=i&(~mask);
@@ -203,7 +203,7 @@ static DGraph *buildSH(const char cls){
   }
   mask=0x00000001<<numOfLayers;
   for(i=0;i<numSources;i++){
-    snprintf(nm,BLOCK_SIZE,"Sink.%d",i);
+    snprintf(nm, BLOCK_SIZE, "Sink.%u", i);
     nd=newNode(nm);
     AttachNode(dg,nd);
     ndoff=i&(~mask);
@@ -240,7 +240,6 @@ static DGraph *buildWH(const char cls){
     AttachNode(dg,nd);
   }
   totComparators=0;
-  numPrevLayerNodes=numLayerNodes;
   while(numLayerNodes>maxInDeg){
     numLayerNodes=numLayerNodes/maxInDeg;
     if(numLayerNodes*maxInDeg<numPrevLayerNodes)
@@ -263,7 +262,7 @@ static DGraph *buildWH(const char cls){
     numPrevLayerNodes=numLayerNodes;
   }
   source=newNode((char*)"Source");
-  AttachNode(dg,source);   
+  AttachNode(dg,source);
   for(i=0;i<numPrevLayerNodes;i++){
     nd=dg->node[firstLayerNode+i];
     ar=newArc(source,nd);
@@ -323,7 +322,7 @@ static DGraph *buildBH(const char cls){
     numPrevLayerNodes=numLayerNodes;
   }
   sink=newNode((char*)"Sink");
-  AttachNode(dg,sink);   
+  AttachNode(dg,sink);
   for(i=0;i<numPrevLayerNodes;i++){
     nd=dg->node[firstLayerNode+i];
     ar=newArc(nd,sink);
@@ -428,7 +427,7 @@ static Arr* WindowFilter(Arr *a, Arr* b,int w){
   int i=0,j=0,k=0;
   double rms0=0.0,rms1=0.0,rmsm1=0.0;
   double weight=((double) (w+1))/(w+2);
+
   w+=1;
   if(timer_on){
     timer_clear(w);
@@ -452,7 +451,6 @@ static Arr* WindowFilter(Arr *a, Arr* b,int w){
     }
     if(rmsm1<rms0) k=-1;
     if(k==0){
-      j=i+fielddim;
       a->val[i]=weight*b->val[i];
       a->val[i+1]=weight*b->val[i+1];
       a->val[i+2]=weight*b->val[i+2];
@@ -668,16 +666,16 @@ int main(int argc,char **argv ){
     dg=buildBH(class);
   }else if(strncmp(argv[3],"WH",2)==0){
     dg=buildWH(class);
-  }else if(strncmp(argv[3],"SH",2)==0){
+  }else /* (strncmp(argv[3],"SH",2)==0) */ {
     dg=buildSH(class);
   }
 
-  if(timer_on != 0 && dg && dg->numNodes+1>timers_tot){
+  if(timer_on != 0 && dg->numNodes+1>timers_tot){
     timer_on=0;
     if(my_rank==0)
     fprintf(stderr,"Not enough timers. Node timeing is off. \n");
   }
-  if(dg && dg->numNodes>comm_size){
+  if(dg->numNodes && dg->numNodes>comm_size){
     if(my_rank==0){
     fprintf(stderr,"**  The number of MPI processes should not be less than \n");
     fprintf(stderr,"**  the number of nodes in the graph\n");
@@ -687,7 +685,7 @@ int main(int argc,char **argv ){
     MPI_Finalize();
     exit(0);
   }
-  for(i=0;i<dg->numNodes;i++){
+  for(i=0; i<dg->numNodes; i++){
     dg->node[i]->address=i;
   }
   if( my_rank == 0 ){