Skip to content

Commit

Permalink
v1.1.1 with single device selection capability (+ operator later to b…
Browse files Browse the repository at this point in the history
…e added)
tugrul512bit committed Apr 6, 2017

Verified

This commit was signed with the committer’s verified signature.
1 parent e094481 commit 3855a1f
Showing 2 changed files with 54 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Cekirdekler/Cekirdekler/ClDevice.cs
Original file line number Diff line number Diff line change
@@ -121,6 +121,19 @@ internal ClDevice copy(bool devicePartitionEnabled = false, bool streamingEnable
return result;
}

internal ClDevice copyExact()
{
ClDevice result = new ClDevice(clPlatformForCopy,
deviceTypeCodeInClPlatformForCopy,
iForCopy,
devicePartitionForCopy,
GPU_STREAMForCopy,
MAX_CPUForCopy);


return result;
}

/// <summary>
/// if device has dedicated memory, returns true
/// </summary>
41 changes: 41 additions & 0 deletions Cekirdekler/Cekirdekler/ClObjectApi.cs
Original file line number Diff line number Diff line change
@@ -710,6 +710,47 @@ public class ClDevices : IDeviceQueryable
{
internal ClDevice[] devices;

/// <summary>
/// get 1 platform
/// </summary>
/// <param name="i"></param>
/// <returns></returns>
public ClDevices this[int i]
{
get
{
ClDevices tmp = this.copyExact(new int[] { i });
return tmp;
}
}

internal ClDevices copyExact(int[] j = null)
{
ClDevices tmp = new ClDevices();
if (this.devices != null && this.devices.Length > 0)
{
if (j == null || j.Length == 0)
{
tmp.devices = new ClDevice[this.devices.Length];
for (int i = 0; i < this.devices.Length; i++)
{
tmp.devices[i] = this.devices[i].copyExact();
}
}
else
{
List<ClDevice> devicesTmp = new List<ClDevice>();

tmp.devices = new ClDevice[j.Length];
for (int k = 0; k < j.Length; k++)
if (j[k] >= 0)
devicesTmp.Add(this.devices[j[k]].copyExact());
tmp.devices = devicesTmp.ToArray();
}
}
return tmp;
}

internal ClDevices copy(int[] j = null, bool devicePartitionEnabled = false, bool streamingEnabled = false, int MAX_CPU_CORES = -1)
{
ClDevices tmp = new ClDevices();

0 comments on commit 3855a1f

Please sign in to comment.