Skip to content

Commit

Permalink
buffers refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Dermody committed Feb 20, 2021
1 parent 50213f9 commit eb59a70
Show file tree
Hide file tree
Showing 34 changed files with 551 additions and 234 deletions.
42 changes: 36 additions & 6 deletions BrightData.Cuda/BrightData.Cuda.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>3.0.0-beta</Version>
<Authors>Jack Dermody</Authors>
<Company />
<Product />
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryUrl>https://github.com/jdermody/brightwire</RepositoryUrl>
<PackageProjectUrl>https://github.com/jdermody/brightwire</PackageProjectUrl>
<Description>Cuda provider for Bright Data - allows GPU computation</Description>
<Copyright>Copyright © Jack Dermody 2016-2021</Copyright>
<PackageTags>cuda gpu</PackageTags>
<PackageIcon>bw_favicon.png</PackageIcon>
<PackageReleaseNotes>Beta release</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -12,6 +24,30 @@
<Compile Remove="Properties\**" />
<EmbeddedResource Remove="Properties\**" />
<None Remove="Properties\**" />
<None Remove="cuda\brightwire.ptx" />
<Content Include="cuda\brightwire.ptx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="..\bw_favicon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="managed-cuda\CudaBlas.netCore.dll">
<Pack>True</Pack>
<PackagePath>lib/netcoreapp3.1</PackagePath>
</None>
<None Include="managed-cuda\CudaSolve.netCore.dll">
<Pack>True</Pack>
<PackagePath>lib/netcoreapp3.1</PackagePath>
</None>
<None Include="managed-cuda\ManagedCuda.netCore.dll">
<Pack>True</Pack>
<PackagePath>lib/netcoreapp3.1</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
Expand All @@ -34,10 +70,4 @@
</Reference>
</ItemGroup>

<ItemGroup>
<None Update="cuda\brightwire.ptx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions BrightData.Numerics/BrightData.Numerics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>3.0.0-beta</Version>
<Authors>Jack Dermody</Authors>
<Product>Bright ML</Product>
<Description>Numerics provider for Bright Data - allows CPU computation, including with MKL</Description>
<Copyright>Copyright © Jack Dermody 2016-2021</Copyright>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/jdermody/brightwire</PackageProjectUrl>
<RepositoryUrl>https://github.com/jdermody/brightwire</RepositoryUrl>
<PackageTags>mkl</PackageTags>
<PackageIcon>bw_favicon.png</PackageIcon>
<PackageReleaseNotes>Beta release</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -16,4 +27,15 @@
<ProjectReference Include="..\BrightData\BrightData.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="..\bw_favicon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
16 changes: 10 additions & 6 deletions BrightData.UnitTests/BufferTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Xunit;
using BrightData.Buffer;
using FluentAssertions;
Expand Down Expand Up @@ -99,10 +100,11 @@ void StringBufferReadWriteTest(IBrightDataContext context, uint numItems, uint b
using var stream = new MemoryStream();
buffer.CopyTo(stream);
stream.Seek(0, SeekOrigin.Begin);
using var reader = new BinaryReader(stream, Encoding.UTF8, true);

uint index = 0;
var reader = context.GetReader<string>(stream, inMemoryReadSize);
foreach (var item in reader.EnumerateTyped())
var bufferReader = context.GetBufferReader<string>(reader, inMemoryReadSize);
foreach (var item in bufferReader.EnumerateTyped())
item.Should().Be(indexTranslator(index++));
}

Expand All @@ -115,10 +117,11 @@ void ObjectBufferReadWriteTest<T>(IBrightDataContext context, uint numItems, uin
using var stream = new MemoryStream();
buffer.CopyTo(stream);
stream.Seek(0, SeekOrigin.Begin);
using var reader = new BinaryReader(stream, Encoding.UTF8, true);

uint index = 0;
var reader = context.GetReader<T>(stream, inMemoryReadSize);
foreach (var item in reader.EnumerateTyped())
var bufferReader = context.GetBufferReader<T>(reader, inMemoryReadSize);
foreach (var item in bufferReader.EnumerateTyped())
item.Should().Be(indexTranslator(index++));
}

Expand All @@ -131,10 +134,11 @@ void StructBufferReadWriteTest<T>(IBrightDataContext context, uint numItems, uin
using var stream = new MemoryStream();
buffer.CopyTo(stream);
stream.Seek(0, SeekOrigin.Begin);
using var reader = new BinaryReader(stream, Encoding.UTF8, true);

uint index = 0;
var reader = context.GetReader<T>(stream, inMemoryReadSize);
foreach (var item in reader.EnumerateTyped())
var bufferReader = context.GetBufferReader<T>(reader, inMemoryReadSize);
foreach (var item in bufferReader.EnumerateTyped())
item.Should().Be(indexTranslator(index++));
}
}
Expand Down
23 changes: 23 additions & 0 deletions BrightData/BrightData.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>3.0.0-beta</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/jdermody/brightwire</PackageProjectUrl>
<RepositoryUrl>https://github.com/jdermody/brightwire</RepositoryUrl>
<Authors>Jack Dermody</Authors>
<Company />
<Product>Bright ML</Product>
<Description>Bright data is a performance oriented data table and linear algebra library that supports both CPU and GPU computation</Description>
<Copyright>Copyright © Jack Dermody 2016-2021</Copyright>
<PackageIcon>bw_favicon.png</PackageIcon>
<PackageReleaseNotes>Beta release</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -20,4 +32,15 @@
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\bw_favicon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
Loading

0 comments on commit eb59a70

Please sign in to comment.