@@ -2955,13 +2955,11 @@ algorithm
29552955 (exeCosts,pos) := HpcOmScheduler . quicksortWithOrder(exeCosts);
29562956 singleNodes := List . map1(pos,List . getIndexFirst,singleNodes);
29572957 singleNodes := listReverse(singleNodes);
2958- // print("singleNodes "+&stringDelimitList(List.map(singleNodes,intString),"\n")+&"\n");
2958+ // print("singleNodes "+&stringDelimitList(List.map(singleNodes,intString),"\n")+&"\n");
29592959 exeCosts := listReverse(exeCosts);
2960- // print("exeCosts "+&stringDelimitList(List.map(exeCosts,realString),"\n")+&"\n");
29612960 // cluster these singleNodes
29622961 (cluster,costs) := distributeToClusters(singleNodes,exeCosts,numProc);
2963- // print("cluster "+&stringDelimitList(List.map(arrayList(cluster),intLstString),"\n")+&"\n");
2964- // print("costs "+&stringDelimitList(List.map(arrayList(costs),realString),"\n")+&"\n");
2962+ // print("cluster "+&stringDelimitList(List.map(arrayList(cluster),intLstString),"\n")+&"\n");
29652963 // update taskgraph and taskgraphMeta
29662964 clusterLst := arrayList(cluster);
29672965 (oTaskGraph,oTaskGraphMeta) := contractNodesInGraph(clusterLst,iTaskGraph,iTaskGraphMeta);
@@ -3002,7 +3000,7 @@ algorithm
30023000 (clustersOut,clusterValuesOut) := matchcontinue(tplIn,tplFold,numClusters)
30033001 local
30043002 Integer numCl, diff;
3005- list< Integer > itemsIn,lst1,lst2, lst1_1,lst1_2,idcsLst1_2,idcsLst2,idcsLst1;
3003+ list< Integer > itemsIn,lst1,lst1_1,lst1_2,idcsLst1_2,idcsLst2,idcsLst1;
30063004 list< list< Integer >> entries,entries2;
30073005 list< Real > valuesIn,values,addValues;
30083006 array< list< Integer >> clusters, clustersFinal;
@@ -3018,49 +3016,33 @@ algorithm
30183016 equation
30193017 true = listLength(itemsIn) > numClusters;
30203018 true = listLength(itemsIn)/ 2 < numClusters;
3021- // print("final split\n");
3022- (lst1,lst2) = List . split(itemsIn,numClusters); // split the list of items+dummies in the middle
3023- lst2 = listReverse(lst2);
3019+ (lst1,_) = List . split(itemsIn,numClusters); // split the list of items+dummies in the middle
30243020 diff = listLength(itemsIn) - numClusters;
3025- // print("clustersIn "+&stringDelimitList(List.map(arrayList(clusters),intLstString),"\n")+&"\n");
3026- (idcsLst1_2,_) = List . split(lst1,numClusters- diff);
3027- idcsLst2 = List . intRange2(numClusters+ 1 ,listLength(itemsIn));
30283021 idcsLst1 = List . intRange2(numClusters- diff+ 1 ,numClusters);
3029- // print("idcsLst1 "+&stringDelimitList(List.map(idcsLst1,intString),"\n")+&"\n");
3030- // print("idcsLst2 "+&stringDelimitList(List.map(idcsLst2,intString),"\n")+&"\n");
3031-
3022+ idcsLst2 = List . intRange2(numClusters+ 1 ,listLength(itemsIn));
30323023 // update the clusters array
30333024 entries = List . map1(idcsLst2,Util . arrayGetIndexFirst,clusters);
30343025 entries = listReverse(entries);
3035- entries2 = List . map1(idcsLst1_2 ,Util . arrayGetIndexFirst,clusters);
3036- entries = List . threadMap(entries,entries2,listAppend);
3026+ entries2 = List . map1(idcsLst1 ,Util . arrayGetIndexFirst,clusters);
3027+ entries = List . threadMap(entries,entries2,listAppend);
30373028 List . threadMap1_0(idcsLst1,entries,Util . arrayUpdateIndexFirst,clusters);
30383029 // update the clusterValues array
30393030 values = List . map1(idcsLst1,Util . arrayGetIndexFirst,clusterValues);
30403031 addValues = List . map1(idcsLst2,Util . arrayGetIndexFirst,clusterValues);
30413032 values = List . threadMap(values,addValues,realAdd);
30423033 List . threadMap1_0(idcsLst1,values,Util . arrayUpdateIndexFirst,clusterValues);
3043- // finish
3044- // print("clustersOut "+&stringDelimitList(List.map(arrayList(clusters),intLstString),"\n")+&"\n");
3045-
3034+ // finish
30463035 (clusters,clusterValues) = distributeToClusters1((lst1,valuesIn),(clusters,clusterValues),numClusters);
30473036 then (clusters,clusterValues);
30483037 case ((itemsIn,valuesIn),(clusters,clusterValues),_)
30493038 equation
30503039 true = listLength(itemsIn) > numClusters;
30513040 true = listLength(itemsIn)/ 2 >= numClusters;
3052- // print("split\n");
30533041 numCl = nextGreaterPowerOf2(intReal(listLength(itemsIn)));
3054- (lst1,lst2) = List . split(itemsIn,intDiv(numCl,2 )); // split the list of items+dummies in the middle
3055- (lst1_1,lst1_2) = List . split(lst1,intDiv(numCl,2 )- listLength(lst2));
3056- lst2 = listReverse(lst2);
3042+ (lst1,_) = List . split(itemsIn,intDiv(numCl,2 )); // split the list of items+dummies in the middle
30573043 // update the clusters array
3058- // print("clustersIn "+&stringDelimitList(List.map(arrayList(clusters),intLstString),"\n")+&"\n");
3059-
30603044 idcsLst2 = List . intRange2(intDiv(numCl,2 )+ 1 ,listLength(itemsIn));
30613045 idcsLst1_2 = List . intRange2(intDiv(numCl,2 )- listLength(idcsLst2)+ 1 , intDiv(numCl,2 ));
3062- // print("idcsLst2 "+&stringDelimitList(List.map(idcsLst2,intString),"\n")+&"\n");
3063- // print("idcsLst1_2 "+&stringDelimitList(List.map(idcsLst1_2,intString),"\n")+&"\n");
30643046 entries = List . map1(idcsLst2,Util . arrayGetIndexFirst,clusters); // the clustered task from the second list
30653047 entries = listReverse(entries);
30663048 entries2 = List . map1(idcsLst1_2,Util . arrayGetIndexFirst,clusters);
@@ -3072,7 +3054,6 @@ algorithm
30723054 values = List . threadMap(values,addValues,realAdd);
30733055 List . threadMap1_0(idcsLst1_2,values,Util . arrayUpdateIndexFirst,clusterValues);
30743056 // again
3075- // print("clustersOut "+&stringDelimitList(List.map(arrayList(clusters),intLstString),"\n")+&"\n");
30763057 (clusters,clusterValues) = distributeToClusters1((lst1,valuesIn),(clusters,clusterValues),numClusters);
30773058 then (clusters,clusterValues);
30783059 else
0 commit comments