New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GIO] New Implementation of IOGEN #1672
Changes from 84 commits
cf6ab0a
6e8b649
bdc9ce8
7a1cf72
360f570
8dedf85
6ab2921
c7daac6
0ab6ddc
239e781
2f40135
00f6d65
b92a88c
d866f10
89b2ae0
0110eb9
a828d14
030f15e
87c4e8c
ee8c972
cc0394e
f9d8f89
3db25e3
c4b8ec7
f3a2b62
409c06d
c1f1799
bd4cbef
28ae8b9
72b7507
078266c
951f3c3
897d3e8
bb4394c
5c7190f
2aae0ee
3baaca0
350282a
d84c3e9
1d3895a
d26aafd
4b98c6d
2b9e79e
a34cd64
c09aac0
6c1e602
5fe869a
28b9f0e
29d83fa
d377fd0
93c6e9e
9cdba95
ff3a5e9
893c43d
3d4b36c
e1b2ff5
caf01d8
0c27ee2
cefabd0
bbf0f70
3ffecd5
283e83a
1091058
3284b7b
bd84592
014a987
9afaf2a
31fe364
0443417
95d8bce
f39ef6f
c1253a9
36b1c98
2489647
9d98d58
d541fd3
cd9b54a
5ee9d77
d630726
46f3c1b
b4d4fd3
2f66e41
d612708
21bddc0
f096a22
ac02ff1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
import org.apache.sysds.conf.ConfigurationManager; | ||
import org.apache.sysds.hops.rewrite.HopRewriteUtils; | ||
import org.apache.sysds.lops.Data; | ||
import org.apache.sysds.lops.DataIOGen; | ||
import org.apache.sysds.lops.Federated; | ||
import org.apache.sysds.lops.Lop; | ||
import org.apache.sysds.common.Types.ExecType; | ||
|
@@ -54,11 +55,15 @@ public class DataOp extends Hop { | |
|
||
//read dataop properties | ||
private FileFormat _inFormat = FileFormat.TEXT; | ||
private String _inIOGenFormat; | ||
private long _inBlocksize = -1; | ||
private boolean _hasOnlyRDD = false; | ||
|
||
private boolean _recompileRead = true; | ||
|
||
private boolean _ioGenRead = false; | ||
private GenerateReaderOp _generateReaderOp; | ||
|
||
/** | ||
* List of "named" input parameters. They are maintained as a hashmap: | ||
* parameter names (String) are mapped as indices (Integer) into getInput() | ||
|
@@ -247,6 +252,26 @@ public void setFileName(String fn) { | |
_fileName = fn; | ||
} | ||
|
||
public void setIOGenRead(boolean isIOGenRead) { | ||
_ioGenRead = isIOGenRead; | ||
} | ||
|
||
public boolean isIOGenRead(){ | ||
return _ioGenRead; | ||
} | ||
|
||
public String getIOGenFormat() { | ||
return _inIOGenFormat; | ||
} | ||
|
||
public void setIOGenFormat(String ioGenFormat) { | ||
this._inIOGenFormat = ioGenFormat; | ||
} | ||
|
||
public void setGenerateReaderOp(GenerateReaderOp op){ | ||
_generateReaderOp = op; | ||
} | ||
|
||
public String getFileName() { | ||
return _fileName; | ||
} | ||
|
@@ -283,20 +308,28 @@ public Lop constructLops() | |
for (Entry<String, Integer> cur : _paramIndexMap.entrySet()) { | ||
inputLops.put(cur.getKey(), getInput().get(cur.getValue()).constructLops()); | ||
} | ||
if(_ioGenRead) | ||
inputLops.put("iogenformat", _generateReaderOp.constructLops()); | ||
|
||
// Create the lop | ||
switch(_op) | ||
{ | ||
case TRANSIENTREAD: | ||
l = new Data(_op, null, inputLops, getName(), null, | ||
getDataType(), getValueType(), getFileFormat()); | ||
if(!_ioGenRead) | ||
l = new Data(_op, null, inputLops, getName(), null, getDataType(), getValueType(), getFileFormat()); | ||
else | ||
l = new DataIOGen(_op, null, inputLops, getName(), null, getDataType(), getValueType(), getIOGenFormat()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe Transient Reads, should not be affected by DataIOGen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are identifying the format and generating corresponding readers to that and then reusing it multiple times, I think it can be Transient. |
||
setOutputDimensions(l); | ||
break; | ||
|
||
case PERSISTENTREAD: | ||
l = new Data(_op, null, inputLops, getName(), null, | ||
getDataType(), getValueType(), getFileFormat()); | ||
l.getOutputParameters().setDimensions(getDim1(), getDim2(), _inBlocksize, getNnz(), getUpdateType()); | ||
if(!_ioGenRead){ | ||
l = new Data(_op, null, inputLops, getName(), null, getDataType(), getValueType(), getFileFormat()); | ||
l.getOutputParameters().setDimensions(getDim1(), getDim2(), _inBlocksize, getNnz(), getUpdateType()); | ||
} | ||
else | ||
l = new DataIOGen(_op, null, inputLops, getName(), null, getDataType(), getValueType(), getIOGenFormat()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be good if you set the output parameters(dimensions) if known. (like in the not IOGen above). The previous (before your additions) is bad design setting the variables after the call to the method, but it could be you do it inside your constructor? if you do not i suggest to use the method on line 328. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. our design for IOGEN is like this: |
||
|
||
break; | ||
|
||
case PERSISTENTWRITE: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.sysds.hops; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.apache.sysds.common.Types; | ||
import org.apache.sysds.common.Types.DataType; | ||
import org.apache.sysds.lops.Lop; | ||
import org.apache.sysds.lops.ReaderGen; | ||
import org.apache.sysds.runtime.meta.DataCharacteristics; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map.Entry; | ||
|
||
|
||
public class GenerateReaderOp extends Hop { | ||
private static final Log LOG = LogFactory.getLog(GenerateReaderOp.class.getName()); | ||
private Types.OpOpGenerateReader _op; | ||
|
||
/** | ||
* List of "named" input parameters. They are maintained as a hashmap: | ||
* parameter names (String) are mapped as indices (Integer) into getInput() | ||
* arraylist. | ||
* <p> | ||
* i.e., getInput().get(_paramIndexMap.get(parameterName)) refers to the Hop | ||
* that is associated with parameterName. | ||
*/ | ||
private HashMap<String, Integer> _paramIndexMap = new HashMap<>(); | ||
|
||
private GenerateReaderOp() { | ||
//default constructor for clone | ||
} | ||
|
||
@Override | ||
public void checkArity() { | ||
|
||
} | ||
|
||
@Override | ||
public boolean allowsAllExecTypes() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected DataCharacteristics inferOutputCharacteristics(MemoTable memo) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Lop constructLops() { | ||
//return already created lops | ||
if( getLops() != null ) | ||
return getLops(); | ||
|
||
Types.ExecType et = Types.ExecType.CP; | ||
|
||
|
||
// construct lops for all input parameters | ||
HashMap<String, Lop> inputLops = new HashMap<>(); | ||
for (Entry<String, Integer> cur : _paramIndexMap.entrySet()) { | ||
inputLops.put(cur.getKey(), getInput().get(cur.getValue()).constructLops()); | ||
} | ||
|
||
Lop l = new ReaderGen(getInput().get(0).constructLops(),_dataType, _valueType, et, inputLops); | ||
|
||
setLineNumbers(l); | ||
setPrivacy(l); | ||
setLops(l); | ||
|
||
//add reblock/checkpoint lops if necessary | ||
constructAndSetLopsDataFlowProperties(); | ||
|
||
return getLops(); | ||
} | ||
|
||
@Override | ||
protected Types.ExecType optFindExecType(boolean transitive) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getOpString() { | ||
String s = new String(""); | ||
s += _op.toString(); | ||
s += " "+getName(); | ||
return s; | ||
} | ||
|
||
@Override | ||
public boolean isGPUEnabled() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected double computeOutputMemEstimate(long dim1, long dim2, long nnz) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
protected double computeIntermediateMemEstimate(long dim1, long dim2, long nnz) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void refreshSizeInformation() { | ||
|
||
} | ||
|
||
@Override | ||
public Object clone() throws CloneNotSupportedException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean compare(Hop that) { | ||
return false; | ||
} | ||
|
||
/** | ||
* Generate Reader operation for Matrix | ||
* This constructor supports expression in parameters | ||
* @param l ? | ||
* @param dt data type | ||
* @param dop data operator type | ||
* @param in high-level operator | ||
* @param inputParameters input parameters | ||
*/ | ||
public GenerateReaderOp(String l, DataType dt, Types.OpOpGenerateReader dop, Hop in, HashMap<String, Hop> inputParameters) { | ||
_dataType = dt; | ||
_op = dop; | ||
_name = l; | ||
getInput().add(0, in); | ||
in.getParent().add(this); | ||
|
||
if(inputParameters != null) { | ||
int index = 1; | ||
for(Entry<String, Hop> e : inputParameters.entrySet()) { | ||
String s = e.getKey(); | ||
Hop input = e.getValue(); | ||
getInput().add(input); | ||
input.getParent().add(this); | ||
|
||
_paramIndexMap.put(s, index); | ||
index++; | ||
} | ||
} | ||
} | ||
|
||
public Types.OpOpGenerateReader getOp() { | ||
return _op; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this enum if it only has one enum value?