no message
This commit is contained in:
@@ -33,7 +33,7 @@ public class SPF_ModifyArrayDistribution extends SapforModification {
|
||||
@Override
|
||||
public void fillFields() {
|
||||
Vector<ArrayAlignmentBar> bars = new Vector<>();
|
||||
for (ProjectArray array : Result.arrays.values()) {
|
||||
for (ProjectArray array : Result.arraysMap.values()) {
|
||||
if (array.canBeDistributed() && array.align_template != null) {
|
||||
array.bar = null;
|
||||
ArrayAlignmentBar bar = new ArrayAlignmentBar(array);
|
||||
@@ -47,7 +47,7 @@ public class SPF_ModifyArrayDistribution extends SapforModification {
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
for (ProjectArray array : Result.arrays.values()) {
|
||||
for (ProjectArray array : Result.arraysMap.values()) {
|
||||
if (array.bar != null) {
|
||||
array.bar.apply_changes();
|
||||
//заполнение новых коеффициентов.
|
||||
@@ -58,7 +58,7 @@ public class SPF_ModifyArrayDistribution extends SapforModification {
|
||||
if (!dialog.ShowDialog(region.toString(), region))
|
||||
return false;
|
||||
boolean needsChange = false;
|
||||
for (ProjectArray array : region.arrays.values()) {
|
||||
for (ProjectArray array : region.arraysMap.values()) {
|
||||
if (array.canBeDistributed() && array.ac_need_change()) {
|
||||
needsChange = true;
|
||||
break;
|
||||
@@ -67,7 +67,7 @@ public class SPF_ModifyArrayDistribution extends SapforModification {
|
||||
if (needsChange) {
|
||||
addOpt1 = region.regionId.toString();
|
||||
Vector<String> coeffs = new Vector<>();
|
||||
for (ProjectArray array : region.arrays.values()) {
|
||||
for (ProjectArray array : region.arraysMap.values()) {
|
||||
if (array.ac_new.size() > 0) {
|
||||
coeffs.add(String.valueOf(array.address));
|
||||
for (int dim : array.ac_new.keySet()) {
|
||||
|
||||
@@ -505,7 +505,7 @@ public class db_project_info extends DBObject {
|
||||
if (templates.size() > 0) {
|
||||
for (ParallelRegion p : parallelRegions.Data.values()) {
|
||||
DefaultMutableTreeNode pn = new DefaultMutableTreeNode(p);
|
||||
p.dataDirectives.genRules(p.arrays);
|
||||
p.dataDirectives.genRules(p.arraysMap);
|
||||
for (String r : p.dataDirectives.rules)
|
||||
pn.add(new DefaultMutableTreeNode(r));
|
||||
maxdim = Math.max(maxdim, p.maxdim);
|
||||
|
||||
@@ -43,10 +43,10 @@ public class AlignRule {
|
||||
return new Pair<>(sign, buf);
|
||||
}
|
||||
public ProjectArray getAlignArray() {
|
||||
return parent_region.arrays.get(alignArray_address);
|
||||
return parent_region.arraysMap.get(alignArray_address);
|
||||
}
|
||||
public ProjectArray getAlignWith() {
|
||||
return parent_region.arrays.get(alignWith_address);
|
||||
return parent_region.arraysMap.get(alignWith_address);
|
||||
}
|
||||
String genStringExpr(String letter, Pair<Integer, Integer> expr) {
|
||||
String retVal = "";
|
||||
|
||||
@@ -10,24 +10,6 @@ public class DataDirective extends Directive {
|
||||
public Vector<AlignRule> alignRules;
|
||||
public String rules_ = "";
|
||||
public Vector<String> rules = new Vector<>();
|
||||
public void genRules_(LinkedHashMap<Long, ProjectArray> Arrays) {
|
||||
rules_ = "";
|
||||
int maxLen = 0;
|
||||
for (AlignRule a : alignRules)
|
||||
maxLen = Math.max(maxLen, a.GetLenString());
|
||||
LinkedHashMap<String, Vector<String>> toPrint = new LinkedHashMap<>();
|
||||
for (AlignRule a : alignRules) {
|
||||
if (Arrays.get(a.alignArray_address).getLocation() != ArrayLocation.parameter) {
|
||||
Pair<String, String> result = a.GenRule(maxLen);
|
||||
if (!toPrint.containsKey(result.getKey()))
|
||||
toPrint.put(result.getKey(), new Vector<>());
|
||||
toPrint.get(result.getKey()).add(result.getValue());
|
||||
}
|
||||
}
|
||||
for (Vector<String> v : toPrint.values()) {
|
||||
rules_ += String.join("\n", v);
|
||||
}
|
||||
}
|
||||
public void genRules(LinkedHashMap<BigInteger, ProjectArray> Arrays) {
|
||||
rules.clear();
|
||||
int maxLen = 0;
|
||||
|
||||
@@ -25,6 +25,8 @@ public class ProjectArray extends DBObject {
|
||||
@Expose
|
||||
public long id;
|
||||
@Expose
|
||||
public String packed_address;
|
||||
@Expose
|
||||
public String name;
|
||||
@Expose
|
||||
public String shortName;
|
||||
@@ -58,10 +60,12 @@ public class ProjectArray extends DBObject {
|
||||
//json-------------------
|
||||
public String UniqKey;
|
||||
public BigInteger address;
|
||||
// LinkedHashMap<BigInteger, TemplateLink> templateInfo = new LinkedHashMap<>();
|
||||
public void print(){
|
||||
Vector<String> res = new Vector<>();
|
||||
res.add(">");
|
||||
res.add("id="+id);
|
||||
res.add("packed_address="+ packed_address);
|
||||
res.add("name="+name);
|
||||
res.add("shortName="+shortName);
|
||||
res.add("dimSize="+dimSize);
|
||||
@@ -74,7 +78,6 @@ public class ProjectArray extends DBObject {
|
||||
res.add("<");
|
||||
System.out.println(String.join("\n",res));
|
||||
}
|
||||
|
||||
//--
|
||||
public ArrayState getState() {
|
||||
return ArrayState.fromInt(state);
|
||||
@@ -85,10 +88,9 @@ public class ProjectArray extends DBObject {
|
||||
public ArrayLocation getLocation() {
|
||||
return ArrayLocation.fromInt(location);
|
||||
}
|
||||
|
||||
//только для шаблонов. для ФИЛЬТРА управления распределением измерений.
|
||||
public Vector<TemplateDimension> dimensions = new Vector<>();
|
||||
//----------------------------
|
||||
//------
|
||||
public ParallelRegion parent_region = null; //родительяская область распараллеливания.
|
||||
//связи->
|
||||
public LinkedHashMap<Long, ProjectArray> links = new LinkedHashMap<>();
|
||||
@@ -106,8 +108,6 @@ public class ProjectArray extends DBObject {
|
||||
//------------------------------------------------------------------------------------------------------>
|
||||
//<editor-fold desc="Функционал шаблона">
|
||||
public Vector<BigInteger> regIDs = new Vector<>();
|
||||
|
||||
|
||||
//--
|
||||
public ProjectArray(String[] infoF, Index idx, BigInteger address_in) {
|
||||
id = Integer.parseInt(infoF[idx.Inc()]); //+
|
||||
@@ -115,7 +115,7 @@ public class ProjectArray extends DBObject {
|
||||
shortName = infoF[idx.Inc()]; //+
|
||||
dimSize = Integer.parseInt(infoF[idx.Inc()]); //+
|
||||
typeSize = Integer.parseInt(infoF[idx.Inc()]); //+
|
||||
// address = address_in;
|
||||
address = address_in;
|
||||
state = Integer.parseInt(infoF[idx.Inc()]); //+
|
||||
location = Integer.parseInt(infoF[idx.Inc()]); //+
|
||||
locName = infoF[idx.Inc()]; //+
|
||||
@@ -132,12 +132,14 @@ public class ProjectArray extends DBObject {
|
||||
for (int i = 0; i < sizes_size; ++i)
|
||||
mappedDims.add(Integer.parseInt(infoF[idx.Inc()])); //+
|
||||
|
||||
//todo удалить после перехода на json
|
||||
int templateInfo_size = Integer.parseInt(infoF[idx.Inc()]);
|
||||
for (int i = 0; i < templateInfo_size; ++i) {
|
||||
BigInteger key = new BigInteger(infoF[idx.Inc()]);
|
||||
TemplateLink templateLink = new TemplateLink(infoF, idx);
|
||||
// templateInfo.put(key, templateLink);
|
||||
// templateInfo.put(key, templateLink);
|
||||
}
|
||||
//todo
|
||||
String[] localSplited = infoF[idx.Inc()].split("\\|");
|
||||
isTemplFlag = Integer.parseInt(localSplited[0]); //+
|
||||
isLoopArrayFlag = Integer.parseInt(localSplited[1]); //+
|
||||
@@ -147,7 +149,6 @@ public class ProjectArray extends DBObject {
|
||||
String declFile = Utils_.toW(localSplited[idxPl]);
|
||||
DBProjectFile file = Global.mainModule.getProject().db.files.Data.get(declFile);
|
||||
int declLine = Integer.parseInt(localSplited[idxPl + 1]);
|
||||
//declPlaces.add(new Pair<>(declFile, declLine));
|
||||
ArrayDecl decl = new ArrayDecl(shortName, location, file, declLine);
|
||||
declPlaces.add(decl);
|
||||
file.array_decls.add(decl); //++
|
||||
@@ -158,12 +159,11 @@ public class ProjectArray extends DBObject {
|
||||
Init();
|
||||
}
|
||||
public void Init(){
|
||||
// address = packed_address !=null ? new BigInteger(packed_address):BigInteger.ONE;
|
||||
//короткое имя+ функция/модуль/комон+ размерность
|
||||
UniqKey = shortName + locName + dimSize;
|
||||
address = BigInteger.ONE;
|
||||
for (ArrayDecl arrayDecl: declPlaces){
|
||||
for (ArrayDecl arrayDecl: declPlaces)
|
||||
arrayDecl.file = Utils_.toW(arrayDecl.file);
|
||||
}
|
||||
}
|
||||
public static String fill_binary(int d, String binary) {
|
||||
int delta = Math.abs(binary.length() - d);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Regions;
|
||||
import Common.Utils.IntegerPairJson;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class FileRegionLinesJson {
|
||||
@Expose
|
||||
public String file;
|
||||
@Expose
|
||||
public List<IntegerPairJson> lines = new Vector<>();
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Regions;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.Index;
|
||||
import Common.Utils.IntegerPairJson;
|
||||
import Common.Utils.Pair;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
@@ -8,18 +9,30 @@ import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.AlignRule;
|
||||
import _VisualDVM.ProjectData.SapforData.Arrays.Distribution.DataDirective;
|
||||
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class ParallelRegion extends DBObject {
|
||||
//json
|
||||
@Expose
|
||||
public String packed_region_id;
|
||||
@Expose
|
||||
public String originalName;
|
||||
@Expose
|
||||
public List<ProjectArray> arrays=new Vector<>();
|
||||
@Expose
|
||||
public RegionLinesJson packed_lines;
|
||||
//--
|
||||
public BigInteger regionId;
|
||||
//name in program
|
||||
public String originalName;
|
||||
|
||||
// file -> <start, end> lines
|
||||
public LinkedHashMap<String, Vector<Pair<Integer, Integer>>> lines;
|
||||
public LinkedHashMap<String, List<IntegerPairJson>> lines;
|
||||
//ключ - адрес. меняем
|
||||
public LinkedHashMap<BigInteger, ProjectArray> arrays;
|
||||
public LinkedHashMap<BigInteger, ProjectArray> arraysMap;
|
||||
//for directive creating
|
||||
public DataDirective dataDirectives;
|
||||
public int maxdim = 0;
|
||||
@@ -30,9 +43,8 @@ public class ParallelRegion extends DBObject {
|
||||
public int fd_count = 0;
|
||||
public int fc_count = 0;
|
||||
public ParallelRegion(String[] splited, Index idx) {
|
||||
// regionId = Long.parseLong(splited[idx.Inc()]);
|
||||
regionId = new BigInteger(splited[idx.Inc()]);
|
||||
originalName = splited[idx.Inc()];
|
||||
regionId = new BigInteger(splited[idx.Inc()]);//+
|
||||
originalName = splited[idx.Inc()];//+
|
||||
String[] localSplited = splited[idx.Inc()].split("\\|");
|
||||
int lines_size = Integer.parseInt(localSplited[0]);
|
||||
lines = new LinkedHashMap<>(lines_size);
|
||||
@@ -41,25 +53,24 @@ public class ParallelRegion extends DBObject {
|
||||
for (int i = 0; i < lines_size; ++i) {
|
||||
String line_file = Utils_.toW(localSplited[1]);
|
||||
int line_list_size = Integer.parseInt(localSplited[2]);
|
||||
Vector<Pair<Integer, Integer>> current_lines = new Vector<>(line_list_size);
|
||||
Vector<IntegerPairJson> current_lines = new Vector<>(line_list_size);
|
||||
for (int k = 0; k < line_list_size; ++k) {
|
||||
int first = Integer.parseInt(splited[idx.Inc()]);
|
||||
if (first == 0) first++;
|
||||
localSplited = splited[idx.Inc()].split("\\|");
|
||||
int second = Integer.parseInt((localSplited[0]));
|
||||
current_lines.add(new Pair<>(first, second));
|
||||
current_lines.add(new IntegerPairJson(first, second));
|
||||
fragments.add(line_file + ": " + first + "-" + second);
|
||||
}
|
||||
lines.put(line_file, current_lines);
|
||||
}
|
||||
maxdim = 0;
|
||||
int arrays_size = Integer.parseInt(splited[idx.Inc()]);
|
||||
arrays = new LinkedHashMap<>(arrays_size);
|
||||
arraysMap = new LinkedHashMap<>(arrays_size);
|
||||
for (int i = 0; i < arrays_size; ++i) {
|
||||
//long array_address = Long.parseLong((splited[idx.Inc()]));
|
||||
BigInteger array_address = new BigInteger((splited[idx.Inc()]));
|
||||
ProjectArray new_array = new ProjectArray(splited, idx, array_address);
|
||||
arrays.put(array_address, new_array);
|
||||
arraysMap.put(array_address, new_array);
|
||||
//-------------------------------------------------------
|
||||
if (new_array.isTemplFlag == 1) {
|
||||
maxdim = Math.max(maxdim, new_array.dimSize);
|
||||
@@ -80,7 +91,7 @@ public class ParallelRegion extends DBObject {
|
||||
fd_count = 0;
|
||||
fc_count = 0;
|
||||
for (String FKey : lines.keySet()) {
|
||||
for (Pair<Integer, Integer> L : lines.get(FKey)) {
|
||||
for (IntegerPairJson L : lines.get(FKey)) {
|
||||
lines_count += (L.getValue() - L.getKey());
|
||||
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
|
||||
loops_count += f.FragmentLoopCount(L.getKey(), L.getValue());
|
||||
@@ -91,10 +102,10 @@ public class ParallelRegion extends DBObject {
|
||||
//--------------------------------------------------
|
||||
}
|
||||
public boolean ArrayBelongsToRegion(long id) {
|
||||
return arrays.values().stream().anyMatch(array -> array.id == id);
|
||||
return arraysMap.values().stream().anyMatch(array -> array.id == id);
|
||||
}
|
||||
public ProjectArray getArrayById(long id) {
|
||||
for (ProjectArray array : arrays.values()) {
|
||||
for (ProjectArray array : arraysMap.values()) {
|
||||
if (array.id == id) return array;
|
||||
}
|
||||
return null;
|
||||
@@ -110,7 +121,7 @@ public class ParallelRegion extends DBObject {
|
||||
public void UpdateLoopsCount() {
|
||||
loops_count = 0;
|
||||
for (String FKey : lines.keySet()) {
|
||||
for (Pair<Integer, Integer> L : lines.get(FKey)) {
|
||||
for (IntegerPairJson L : lines.get(FKey)) {
|
||||
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
|
||||
loops_count += f.FragmentLoopCount(L.getKey(), L.getValue());
|
||||
}
|
||||
@@ -120,7 +131,7 @@ public class ParallelRegion extends DBObject {
|
||||
fd_count = 0;
|
||||
fc_count = 0;
|
||||
for (String FKey : lines.keySet()) {
|
||||
for (Pair<Integer, Integer> L : lines.get(FKey)) {
|
||||
for (IntegerPairJson L : lines.get(FKey)) {
|
||||
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
|
||||
fc_count += f.FragmentFunctionCallsCount(L.getKey(), L.getValue());
|
||||
fd_count += f.FragmentFunctionDeclsCount(L.getKey(), L.getValue());
|
||||
@@ -130,17 +141,10 @@ public class ParallelRegion extends DBObject {
|
||||
public void UpdateArraysCount() {
|
||||
arrays_count = 0;
|
||||
for (String FKey : lines.keySet()) {
|
||||
for (Pair<Integer, Integer> L : lines.get(FKey)) {
|
||||
for (IntegerPairJson L : lines.get(FKey)) {
|
||||
DBProjectFile f = Global.mainModule.getProject().db.files.Data.get(FKey);
|
||||
arrays_count += f.FragmentArraysCount(L.getKey(), L.getValue());
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (new_array.isTemplFlag == 1) {
|
||||
maxdim = Math.max(maxdim, new_array.dimSize);
|
||||
Current.getProject().templates.put(new_array.address, new_array);
|
||||
new_array.regIDs.add(regionId);
|
||||
} else if (new_array.isLoopArrayFlag != 1) arrays_count++;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Regions;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class RegionLinesJson {
|
||||
@Expose
|
||||
public List<FileRegionLinesJson> allLines = new Vector<>();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package _VisualDVM.ProjectData.SapforData.Regions;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class RegionsJson {
|
||||
@Expose
|
||||
public List<ParallelRegion> allRegions = new Vector<>();
|
||||
}
|
||||
Reference in New Issue
Block a user