Skip to content
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

Convert homogentable to array/vector/matrix #4

Merged
merged 47 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
08352ab
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
a88614f
update ConvertHomogenTableSuite.scala
minmingzhu Apr 17, 2022
aaca1ea
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 17, 2022
5aa8430
update test.sh
minmingzhu Apr 17, 2022
44e00c5
Update build-jni.sh
minmingzhu Apr 17, 2022
244d33d
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 22, 2022
711ba0c
update
minmingzhu Apr 22, 2022
1dfc511
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
77a46a9
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
08c70e2
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
ba99cb6
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 28, 2022
7843ca3
Merge remote-tracking branch 'origin/convert_homogentable' into conve…
minmingzhu Apr 28, 2022
e0b782f
Update ci-local-dpc-test.sh
minmingzhu Apr 28, 2022
6c32fca
merge make_homogen_table
minmingzhu May 9, 2022
f3a72e5
rollback to edb9f3d
minmingzhu May 9, 2022
cc5352c
update
minmingzhu May 9, 2022
884c0b4
Merge remote-tracking branch 'origin/convert_homogentable' into conve…
minmingzhu May 9, 2022
c3b214e
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
47a7171
update ConvertHomogenTableSuite.scala
minmingzhu Apr 17, 2022
4556a5d
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
7f9a768
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
0ea2448
update
minmingzhu May 9, 2022
35af201
update
minmingzhu May 9, 2022
065d0d3
Merge remote-tracking branch 'origin/convert_homogentable' into conve…
minmingzhu May 9, 2022
8ab660d
update
minmingzhu May 9, 2022
0cb1f19
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
354d4a9
update ConvertHomogenTableSuite.scala
minmingzhu Apr 17, 2022
f6c228b
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
e1cba0d
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
fcf8314
rollback to edb9f3d
minmingzhu May 9, 2022
0c4bd73
update
minmingzhu May 9, 2022
2226da9
1. convert homogenTable to array/vector/matrix
minmingzhu Apr 17, 2022
73f99fa
update ColumnAccessorImpl.cpp RowAccessorImpl.cpp
minmingzhu Apr 24, 2022
800845b
Merge branch 'make_homogen_table' into convert_homogentable
minmingzhu Apr 25, 2022
e13e27a
update
minmingzhu May 9, 2022
177e486
update
minmingzhu May 9, 2022
e4778fe
Merge remote-tracking branch 'origin/convert_homogentable' into conve…
minmingzhu May 9, 2022
7114c7c
update
minmingzhu May 9, 2022
ef2a7d7
update cpp style
minmingzhu May 9, 2022
45bf666
Update build.sh
minmingzhu May 10, 2022
5b86e6c
fix comments
minmingzhu May 10, 2022
8f31387
Merge remote-tracking branch 'origin/convert_homogentable' into conve…
minmingzhu May 10, 2022
f060188
update code style
minmingzhu May 10, 2022
d853874
fix comments
minmingzhu May 16, 2022
d84ab04
update
minmingzhu May 16, 2022
961f55f
update
minmingzhu May 16, 2022
9e694f2
update
minmingzhu May 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.intel.oneapi.dal.table;

public class ColumnAccessor {
private long cObject;
private Common.ComputeDevice cDevice;

public ColumnAccessor(long cObject, Common.ComputeDevice device) {
this.cObject = cObject;
this.cDevice = device;
}

public double[] pullDouble(long columnIndex){
return this.cPullDouble(this.cObject, columnIndex, 0, -1, this.cDevice.ordinal());
}

public double[] pullDouble(long columnIndex, long rowStartIndex, long rowEndIndex){
return this.cPullDouble(this.cObject, columnIndex, rowStartIndex, rowEndIndex, this.cDevice.ordinal());
}

public float[] pullFloat(long columnIndex){
return this.cPullFloat(this.cObject, columnIndex, 0, -1, this.cDevice.ordinal());
}

public float[] pullFloat(long columnIndex, long rowStartIndex, long rowEndIndex){
return this.cPullFloat(this.cObject, columnIndex, rowStartIndex, rowEndIndex, this.cDevice.ordinal());
}

public int[] pullInt(long columnIndex){
return this.cPullInt(this.cObject, columnIndex, 0, -1, this.cDevice.ordinal());
}

public int[] pullInt(long columnIndex, long rowStartIndex, long rowEndIndex){
return this.cPullInt(this.cObject, columnIndex, rowStartIndex, rowEndIndex, this.cDevice.ordinal());
}

private native double[] cPullDouble(long cObject, long cColumnIndex,
long cRowStartIndex, long cRowEndIndex, int computeDeviceIndex);
private native int[] cPullInt(long cObject, long cColumnIndex, long cRowStartIndex,
long cRowEndIndex, int computeDeviceIndex);
private native float[] cPullFloat(long cObject, long cColumnIndex, long cRowStartIndex,
long cRowEndIndex, int computeDeviceIndex);

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum ComputeDevice {
public static ComputeDevice get(int ordinal) {
return values[ordinal];
}
public static int getOrdinalByName(String key){
public static ComputeDevice getOrdinalByName(String key){
ComputeDevice device = null;
switch (key.toUpperCase()){
case "HOST":
Expand All @@ -43,7 +43,7 @@ public static int getOrdinalByName(String key){
device = GPU;
break;
}
return device.ordinal();
return device;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,20 @@ public HomogenTable(long cTable){
public HomogenTable(long rowCount,
long colCount,
int[] data,
int deviceIndex){
Common.ComputeDevice device){
super();
// default
Common.DataLayout dataLayout = Common.DataLayout.ROW_MAJOR;
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);
}

public HomogenTable(long rowCount,
long colCount,
int[] data,
int layoutindex,
int deviceIndex){
Common.DataLayout dataLayout,
Common.ComputeDevice device){
super();
Common.DataLayout dataLayout = Common.DataLayout.get(layoutindex);
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);

Expand All @@ -36,75 +33,65 @@ public HomogenTable(long rowCount,
public HomogenTable(long rowCount,
long colCount,
long[] data,
int deviceIndex){
Common.ComputeDevice device){
super();
// default
Common.DataLayout dataLayout = Common.DataLayout.ROW_MAJOR;
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);
}

public HomogenTable(long rowCount,
long colCount,
long[] data,
int layoutIndex,
int deviceIndex){
Common.DataLayout dataLayout,
Common.ComputeDevice device){
super();
Common.DataLayout dataLayout = Common.DataLayout.get(layoutIndex);
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);
}

public HomogenTable(long rowCount,
long colCount,
float[] data,
int deviceIndex){
Common.ComputeDevice device){
super();
// default
Common.DataLayout dataLayout = Common.DataLayout.ROW_MAJOR;
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);
}

public HomogenTable(long rowCount,
long colCount,
float[] data,
int layoutIndex,
int deviceIndex){
Common.DataLayout dataLayout,
Common.ComputeDevice device){
super();
Common.DataLayout dataLayout = Common.DataLayout.get(layoutIndex);
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);
}

public HomogenTable(long rowCount,
long colCount,
double[] data,
int deviceIndex){
Common.ComputeDevice device){
super();
// default
Common.DataLayout dataLayout = Common.DataLayout.ROW_MAJOR;
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);
}

public HomogenTable(long rowCount,
long colCount,
double[] data,
int layoutIndex,
int deviceIndex){
Common.DataLayout dataLayout,
Common.ComputeDevice device){
super();
Common.DataLayout dataLayout = Common.DataLayout.get(layoutIndex);
Common.ComputeDevice device = Common.ComputeDevice.get(deviceIndex);
impl = new HomogenTableImpl(rowCount, colCount, data,
dataLayout, device);
}

@Override
public Long getColumnCount() {
return impl.getColumnCount();
Expand Down Expand Up @@ -150,4 +137,8 @@ public long[] getLongData() {
public double[] getDoubleData() {
return impl.getDoubleData();
}

public long getcObejct() {
return impl.getcObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ public class HomogenTableImpl implements HomogenTableIface {
e.printStackTrace();
}
}
private transient long cObject;
private long cObject;
private TableMetadata metadata;
private Common.ComputeDevice device;

protected HomogenTableImpl() {
super();
Expand All @@ -28,17 +29,17 @@ public HomogenTableImpl(long rowCount,
int[] data,
Common.DataLayout dataLayout,
Common.ComputeDevice computeDevice) {
this.cObject = iInit(rowCount, colCount, data, dataLayout.ordinal(), computeDevice.ordinal());
System.out.println(" HomogenTableImpl object : " + this.cObject);

this.device = computeDevice;
this.cObject = iInit(rowCount, colCount, data, dataLayout.ordinal(), this.device.ordinal());
}

public HomogenTableImpl(long rowCount,
long colCount,
float[] data,
Common.DataLayout dataLayout,
Common.ComputeDevice computeDevice) {
this.cObject = fInit(rowCount, colCount, data, dataLayout.ordinal(), computeDevice.ordinal());
this.device = computeDevice;
this.cObject = fInit(rowCount, colCount, data, dataLayout.ordinal(), this.device.ordinal());

}

Expand All @@ -47,7 +48,8 @@ public HomogenTableImpl(long rowCount,
long[] data,
Common.DataLayout dataLayout,
Common.ComputeDevice computeDevice) {
this.cObject = lInit(rowCount, colCount, data, dataLayout.ordinal(), computeDevice.ordinal());
this.device = computeDevice;
this.cObject = lInit(rowCount, colCount, data, dataLayout.ordinal(), this.device.ordinal());

}

Expand All @@ -56,125 +58,119 @@ public HomogenTableImpl(long rowCount,
double[] data,
Common.DataLayout dataLayout,
Common.ComputeDevice computeDevice) {
this.cObject = dInit(rowCount, colCount, data, dataLayout.ordinal(), computeDevice.ordinal());
this.device = computeDevice;
this.cObject = dInit(rowCount, colCount, data, dataLayout.ordinal(), this.device.ordinal());

}


private native long iInit(long rowCount,
long colCount,
int[] data,
int dataLayoutIndex,
int computeDeviceIndex);

private native long fInit(long rowCount,
long colCount,
float[] data,
int dataLayoutIndex,
int computeDeviceIndex);

private native long dInit(long rowCount,
long colCount,
double[] data,
int dataLayoutIndex,
int computeDeviceIndex);

private native long lInit(long rowCount,
long colCount,
long[] data,
int dataLayoutIndex,
int computeDeviceIndex);

@Override
public long getColumnCount() {
return cGetColumnCount(this.cObject);
}

private native long cGetColumnCount(long cObject);

@Override
public long getRowCount() {
return cGetRowCount(this.cObject);
}

private native long cGetRowCount(long cObject);

@Override
public long getKind() {
return this.cGetKind(this.cObject);
}

private native long cGetKind(long cObject);

@Override
public Common.DataLayout getDataLayout() {

return Common.DataLayout.get(cGetDataLayout(this.cObject));
}

private native int cGetDataLayout(long cObject);

@Override
public TableMetadata getMetaData() {
long cMetadata = cGetMetaData(this.cObject);
this.metadata = new TableMetadata(cMetadata);
return this.metadata;
}

private native long cGetMetaData(long cObject);

@Override
public long getPullRowsIface() {
return 0;
}

private native long cGetPullRowsIface(long cObject);

@Override
public long getPullColumnIface() {
return 0;
public ColumnAccessor getPullColumnIface() {
ColumnAccessor accessor = new ColumnAccessor(cGetPullColumnIface(this.cObject), this.device);
return accessor;
}

private native long cGetPullColumnIface(long cObject);

@Override
public long getPullCSRBlockIface() {
return 0;
}

private native long cGetPullCSRBlockIface(long cObject);

@Override
public boolean hasData() {
return this.getColumnCount() > 0 && this.getRowCount() > 0;
}


@Override
public int[] getIntData() {
return this.cGetIntData(this.cObject);
}

private native int[] cGetIntData(long cObject);

@Override
public long[] getLongData() {
return this.cGetLongData(this.cObject);
}

private native long[] cGetLongData(long cObject);

@Override
public float[] getFloatData() {
return this.cGetFloatData(this.cObject);
}

private native float[] cGetFloatData(long cObject);


@Override
public double[] getDoubleData() {
return cGetDoubleData(this.cObject);
}

public long getcObject(){
return this.cObject;
}

private native long iInit(long rowCount,
long colCount,
int[] data,
int dataLayoutIndex,
int computeDeviceIndex);

private native long fInit(long rowCount,
long colCount,
float[] data,
int dataLayoutIndex,
int computeDeviceIndex);

private native long dInit(long rowCount,
long colCount,
double[] data,
int dataLayoutIndex,
int computeDeviceIndex);

private native long lInit(long rowCount,
long colCount,
long[] data,
int dataLayoutIndex,
int computeDeviceIndex);
private native long cGetColumnCount(long cObject);
private native long cGetRowCount(long cObject);
private native long cGetKind(long cObject);
private native int cGetDataLayout(long cObject);
private native long cGetMetaData(long cObject);
private native long cGetPullRowsIface(long cObject);
private native long cGetPullColumnIface(long cObject);
private native long cGetPullCSRBlockIface(long cObject);
private native int[] cGetIntData(long cObject);
private native long[] cGetLongData(long cObject);
private native float[] cGetFloatData(long cObject);
private native double[] cGetDoubleData(long cObject);
}
Loading