diff --git a/docker/base/centos/7/cuda/11.0/Dockerfile.ignored b/docker/base/centos/7/cuda/11.0/Dockerfile similarity index 100% rename from docker/base/centos/7/cuda/11.0/Dockerfile.ignored rename to docker/base/centos/7/cuda/11.0/Dockerfile diff --git a/docker/base/centos/7/cuda/11.1/Dockerfile b/docker/base/centos/7/cuda/11.1/Dockerfile new file mode 100644 index 00000000..06a2e64c --- /dev/null +++ b/docker/base/centos/7/cuda/11.1/Dockerfile @@ -0,0 +1,12 @@ +FROM nvidia/cuda:11.1-cudnn8-devel-centos7 +LABEL maintainer "Takuya Takeuchi " + +# install package to build +RUN yum update -y && yum install -y \ + ca-certificates +RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm +RUN yum update -y && yum install -y \ + libX11-devel \ + lapack-devel \ + openblas-devel \ + && yum clean all \ No newline at end of file diff --git a/docker/base/ubuntu/16/cuda/11.1/Dockerfile b/docker/base/ubuntu/16/cuda/11.1/Dockerfile new file mode 100644 index 00000000..0ef6f9ae --- /dev/null +++ b/docker/base/ubuntu/16/cuda/11.1/Dockerfile @@ -0,0 +1,9 @@ +FROM nvidia/cuda:11.1-cudnn8-devel-ubuntu16.04 +LABEL maintainer "Takuya Takeuchi " + +# install package to build +RUN apt-get update && apt-get install -y \ + libopenblas-dev \ + liblapack-dev \ + libx11-6 \ + && apt-get clean && rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/docker/devel/centos/7/cuda/11.0/Dockerfile.ignored b/docker/devel/centos/7/cuda/11.0/Dockerfile similarity index 100% rename from docker/devel/centos/7/cuda/11.0/Dockerfile.ignored rename to docker/devel/centos/7/cuda/11.0/Dockerfile diff --git a/docker/devel/centos/7/cuda/11.1/Dockerfile b/docker/devel/centos/7/cuda/11.1/Dockerfile new file mode 100644 index 00000000..70526a8b --- /dev/null +++ b/docker/devel/centos/7/cuda/11.1/Dockerfile @@ -0,0 +1,47 @@ +FROM nvidia/cuda:11.1-cudnn8-devel-centos7 +LABEL maintainer "Takuya Takeuchi " + +# install package to build +RUN yum update -y && yum install -y \ + ca-certificates +RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm +RUN yum update -y && yum install -y \ + libX11-devel \ + lapack-devel \ + openblas-devel \ + cmake3 +RUN yum groupinstall -y "Development Tools" + +# set compiler +ENV CMAKE_C_COMPILER=/usr/bin/gcc +ENV CMAKE_CXX_COMPILER=/usr/bin/g++ + +# set env to build by using CUDA +ENV CUDA_PATH /usr/local/cuda +ENV PATH $CUDA_PATH/bin:$PATH +ENV CPATH $CUDA_PATH/include:$CPATH +ENV LD_LIBRARY_PATH $CUDA_PATH/lib64:$LD_LIBRARY_PATH +ENV NCCL_ROOT /usr/local/nccl +ENV CPATH $NCCL_ROOT/include:$CPATH +ENV LD_LIBRARY_PATH $NCCL_ROOT/lib/:$LD_LIBRARY_PATH +ENV LIBRARY_PATH $NCCL_ROOT/lib/:$LIBRARY_PATH + +# Register Microsoft key and feed +RUN yum update -y && yum install -y \ + curl +RUN curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo +RUN yum update -y && yum install -y \ + powershell \ + && yum clean all + +# user cmake 3 instead of cmake 2 +RUN alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \ + --slave /usr/local/bin/ctest ctest /usr/bin/ctest \ + --slave /usr/local/bin/cpack cpack /usr/bin/cpack \ + --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \ + --family cmake +RUN alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \ + --slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \ + --slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \ + --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \ + --family cmake \ No newline at end of file diff --git a/docker/devel/ubuntu/16/cuda/11.1/Dockerfile b/docker/devel/ubuntu/16/cuda/11.1/Dockerfile new file mode 100644 index 00000000..235d7b47 --- /dev/null +++ b/docker/devel/ubuntu/16/cuda/11.1/Dockerfile @@ -0,0 +1,35 @@ +FROM nvidia/cuda:11.1-cudnn8-devel-ubuntu16.04 +LABEL maintainer "Takuya Takeuchi " + +# install package to build +RUN apt-get update && apt-get install -y \ + build-essential \ + libopenblas-dev \ + liblapack-dev \ + libx11-dev \ + cmake \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# set compiler +ENV CMAKE_C_COMPILER=/usr/bin/gcc +ENV CMAKE_CXX_COMPILER=/usr/bin/g++ + +# set env to build by using CUDA +ENV CUDA_PATH /usr/local/cuda +ENV PATH $CUDA_PATH/bin:$PATH +ENV CPATH $CUDA_PATH/include:$CPATH +ENV LD_LIBRARY_PATH $CUDA_PATH/lib64:$LD_LIBRARY_PATH +ENV NCCL_ROOT /usr/local/nccl +ENV CPATH $NCCL_ROOT/include:$CPATH +ENV LD_LIBRARY_PATH $NCCL_ROOT/lib/:$LD_LIBRARY_PATH +ENV LIBRARY_PATH $NCCL_ROOT/lib/:$LIBRARY_PATH + +# Register Microsoft key and feed +RUN apt-get update && apt-get install -y \ + wget \ + apt-transport-https +RUN wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb +RUN dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb +RUN apt-get update && apt-get install -y \ + powershell \ + && apt-get clean && rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/nuget/BuildCentOS7.ps1 b/nuget/BuildCentOS7.ps1 index 30e0ad4e..e7dbf4fa 100644 --- a/nuget/BuildCentOS7.ps1 +++ b/nuget/BuildCentOS7.ps1 @@ -37,6 +37,7 @@ $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 101 } $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 102 } $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 110 } +$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 111 } #$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 64; Postfix = "64"; RID = "$OperatingSystem-arm64"; CUDA = 0 } #$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 32; Postfix = ""; RID = "$OperatingSystem-arm"; CUDA = 0 } diff --git a/nuget/BuildUbuntu16.ps1 b/nuget/BuildUbuntu16.ps1 index 31d17c0c..ab5622a4 100644 --- a/nuget/BuildUbuntu16.ps1 +++ b/nuget/BuildUbuntu16.ps1 @@ -37,6 +37,7 @@ $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 101 } $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 102 } $BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 110 } +$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "cuda"; Architecture = 64; Postfix = ""; RID = "$OperatingSystem-x64"; CUDA = 111 } #$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 64; Postfix = "64"; RID = "$OperatingSystem-arm64"; CUDA = 0 } #$BuildTargets += New-Object PSObject -Property @{ Platform = "desktop"; Target = "arm"; Architecture = 32; Postfix = ""; RID = "$OperatingSystem-arm"; CUDA = 0 } diff --git a/nuget/BuildUtils.ps1 b/nuget/BuildUtils.ps1 index f7af1251..8f9a3674 100644 --- a/nuget/BuildUtils.ps1 +++ b/nuget/BuildUtils.ps1 @@ -37,7 +37,8 @@ class Config 100, 101, 102, - 110 + 110, + 111 ) $CudaVersionHash = @@ -48,7 +49,8 @@ class Config 100 = "CUDA_PATH_V10_0"; 101 = "CUDA_PATH_V10_1"; 102 = "CUDA_PATH_V10_2"; - 110 = "CUDA_PATH_V11_0" + 110 = "CUDA_PATH_V11_0"; + 111 = "CUDA_PATH_V11_1"; } $VisualStudio = "Visual Studio 15 2017" diff --git a/nuget/BuildWindows.ps1 b/nuget/BuildWindows.ps1 index 66d9b9b1..25d7a3aa 100644 --- a/nuget/BuildWindows.ps1 +++ b/nuget/BuildWindows.ps1 @@ -39,6 +39,7 @@ $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 101 } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 102 } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 110 } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; RID = "$OperatingSystem-x64"; CUDA = 111 } foreach ($BuildTarget in $BuildTargets) { diff --git a/nuget/CreateAllPackage.bat b/nuget/CreateAllPackage.bat index 8f0cc14c..09566494 100644 --- a/nuget/CreateAllPackage.bat +++ b/nuget/CreateAllPackage.bat @@ -6,6 +6,8 @@ pwsh CreatePackage.ps1 CUDA-92 pwsh CreatePackage.ps1 CUDA-100 pwsh CreatePackage.ps1 CUDA-101 pwsh CreatePackage.ps1 CUDA-102 +pwsh CreatePackage.ps1 CUDA-110 +pwsh CreatePackage.ps1 CUDA-111 pwsh CreatePackage.ps1 MKL pwsh CreatePackage.ps1 UWP diff --git a/nuget/Publish.bat b/nuget/Publish.bat index 2278388d..d68ef79e 100644 --- a/nuget/Publish.bat +++ b/nuget/Publish.bat @@ -1,4 +1,6 @@ dotnet nuget push DlibDotNet.MKL.%1.nupkg -k %2 -s https://api.nuget.org/v3/index.json +dotnet nuget push DlibDotNet.CUDA111.%1.nupkg -k %2 -s https://api.nuget.org/v3/index.json +dotnet nuget push DlibDotNet.CUDA110.%1.nupkg -k %2 -s https://api.nuget.org/v3/index.json dotnet nuget push DlibDotNet.CUDA102.%1.nupkg -k %2 -s https://api.nuget.org/v3/index.json dotnet nuget push DlibDotNet.CUDA101.%1.nupkg -k %2 -s https://api.nuget.org/v3/index.json dotnet nuget push DlibDotNet.CUDA100.%1.nupkg -k %2 -s https://api.nuget.org/v3/index.json diff --git a/nuget/TestPackage.ps1 b/nuget/TestPackage.ps1 index c9217d03..ed415d12 100644 --- a/nuget/TestPackage.ps1 +++ b/nuget/TestPackage.ps1 @@ -96,8 +96,7 @@ function RunTest($BuildTargets) # Copy Dependencies $OutDir = Join-Path $TargetDir bin | ` Join-Path -ChildPath Release | ` - Join-Path -ChildPath netcoreapp2.0 | ` - Join-Path -ChildPath $RuntimeIdentifier + Join-Path -ChildPath netcoreapp2.0 if (!(Test-Path "$OutDir")) { New-Item "$OutDir" -ItemType Directory > $null } @@ -108,7 +107,8 @@ function RunTest($BuildTargets) { foreach($Dependency in $BuildTarget.Dependencies) { - Copy-Item "$Dependency" "$OutDir" + $FileName = [System.IO.Path]::GetFileName("$Dependency") + New-Item -Value "$Dependency" -Path "$OutDir" -Name "$FileName" -ItemType SymbolicLink > $null } } } @@ -214,11 +214,32 @@ $tmp102.Add("$env:CUDA_PATH_V10_2\bin\curand64_10.dll") $tmp102.Add("$env:CUDA_PATH_V10_2\bin\cusolver64_10.dll") # For DlibDotNet.CUDA110 -$tmp102 = New-Object 'System.Collections.Generic.List[string]' -$tmp102.Add("$env:CUDA_PATH_V10_2\bin\cublas64_11.dll") -$tmp102.Add("$env:CUDA_PATH_V10_2\bin\cudnn64_8.dll") -$tmp102.Add("$env:CUDA_PATH_V10_2\bin\curand64_10.dll") -$tmp102.Add("$env:CUDA_PATH_V10_2\bin\cusolver64_10.dll") +$tmp110 = New-Object 'System.Collections.Generic.List[string]' +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cublas64_11.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cublasLt64_11.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cudnn_adv_infer64_8.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cudnn_adv_train64_8.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cudnn_cnn_infer64_8.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cudnn_cnn_train64_8.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cudnn_ops_infer64_8.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cudnn_ops_train64_8.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cudnn64_8.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\curand64_10.dll") +$tmp110.Add("$env:CUDA_PATH_V11_0\bin\cusolver64_10.dll") + +# For DlibDotNet.CUDA111 +$tmp111 = New-Object 'System.Collections.Generic.List[string]' +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cublas64_11.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cublasLt64_11.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn_adv_infer64_8.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn_adv_train64_8.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn_cnn_infer64_8.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn_cnn_train64_8.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn_ops_infer64_8.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn_ops_train64_8.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cudnn64_8.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\curand64_10.dll") +$tmp111.Add("$env:CUDA_PATH_V11_1\bin\cusolver64_11.dll") $BuildTargets = @() $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x64"; Architecture = 64; Package = "DlibDotNet"; Dependencies = $null } @@ -230,6 +251,7 @@ $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x64"; Archite $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x64"; Architecture = 64; Package = "DlibDotNet.CUDA101"; Dependencies = $tmp101 } $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x64"; Architecture = 64; Package = "DlibDotNet.CUDA102"; Dependencies = $tmp102 } $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x64"; Architecture = 64; Package = "DlibDotNet.CUDA110"; Dependencies = $tmp110 } +$BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x64"; Architecture = 64; Package = "DlibDotNet.CUDA111"; Dependencies = $tmp111 } $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x64"; Architecture = 64; Package = "DlibDotNet.MKL"; Dependencies = $null } $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "x86"; Architecture = 32; Package = "DlibDotNet.MKL"; Dependencies = $null } $BuildTargets += New-Object PSObject -Property @{PlatformTarget = "arm"; Architecture = 32; Package = "DlibDotNet.ARM"; Dependencies = $null } diff --git a/nuget/TestPackageCentOS7.ps1 b/nuget/TestPackageCentOS7.ps1 index a22b6fa9..3b7fde1e 100644 --- a/nuget/TestPackageCentOS7.ps1 +++ b/nuget/TestPackageCentOS7.ps1 @@ -37,7 +37,8 @@ $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 100; Package = "DlibDotNet.CUDA100"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 101; Package = "DlibDotNet.CUDA101"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "DlibDotNet.CUDA102"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } -$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "DlibDotNet.CUDA110"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 110; Package = "DlibDotNet.CUDA110"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 111; Package = "DlibDotNet.CUDA111"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } foreach($BuildTarget in $BuildTargets) { @@ -76,7 +77,7 @@ foreach($BuildTarget in $BuildTargets) Write-Host "Docker API Version: $dockerAPIVersion" -ForegroundColor Yellow if ($dockerAPIVersion -ge 1.40) { - Write-Host "Start docker run --gpus all --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $OperatingSystem $OperatingSystemVersion" -ForegroundColor Green + Write-Host "Start docker run --gpus all --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $platformTarget $rid" -ForegroundColor Green docker run --gpus all --rm ` -v "$($DlibDotNetRoot):/opt/data/DlibDotNet" ` -e "LOCAL_UID=$(id -u $env:USER)" ` @@ -85,7 +86,7 @@ foreach($BuildTarget in $BuildTargets) } else { - Write-Host "Start docker run --runtime=nvidia --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $OperatingSystem $OperatingSystemVersion" -ForegroundColor Green + Write-Host "Start docker run --runtime=nvidia --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $platformTarget $rid" -ForegroundColor Green docker run --runtime=nvidia --rm ` -v "$($DlibDotNetRoot):/opt/data/DlibDotNet" ` -e "LOCAL_UID=$(id -u $env:USER)" ` @@ -95,7 +96,7 @@ foreach($BuildTarget in $BuildTargets) } else { - Write-Host "Start docker run --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $OperatingSystem $OperatingSystemVersion" -ForegroundColor Green + Write-Host "Start docker run --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $platformTarget $rid" -ForegroundColor Green docker run --rm ` -v "$($DlibDotNetRoot):/opt/data/DlibDotNet" ` -e "LOCAL_UID=$(id -u $env:USER)" ` diff --git a/nuget/TestPackageUbuntu16.ps1 b/nuget/TestPackageUbuntu16.ps1 index 78618d61..f9cd4ab1 100644 --- a/nuget/TestPackageUbuntu16.ps1 +++ b/nuget/TestPackageUbuntu16.ps1 @@ -37,7 +37,8 @@ $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 100; Package = "DlibDotNet.CUDA100"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 101; Package = "DlibDotNet.CUDA101"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "DlibDotNet.CUDA102"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } -$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 102; Package = "DlibDotNet.CUDA110"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 110; Package = "DlibDotNet.CUDA110"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } +$BuildTargets += New-Object PSObject -Property @{Target = "cuda"; Architecture = 64; CUDA = 111; Package = "DlibDotNet.CUDA111"; PlatformTarget="x64"; Postfix = ""; RID = "$RidOperatingSystem-x64"; } foreach($BuildTarget in $BuildTargets) { @@ -76,7 +77,7 @@ foreach($BuildTarget in $BuildTargets) Write-Host "Docker API Version: $dockerAPIVersion" -ForegroundColor Yellow if ($dockerAPIVersion -ge 1.40) { - Write-Host "Start docker run --gpus all --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $OperatingSystem $OperatingSystemVersion" -ForegroundColor Green + Write-Host "Start docker run --gpus all --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $platformTarget $rid" -ForegroundColor Green docker run --gpus all --rm ` -v "$($DlibDotNetRoot):/opt/data/DlibDotNet" ` -e "LOCAL_UID=$(id -u $env:USER)" ` @@ -85,7 +86,7 @@ foreach($BuildTarget in $BuildTargets) } else { - Write-Host "Start docker run --runtime=nvidia --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $OperatingSystem $OperatingSystemVersion" -ForegroundColor Green + Write-Host "Start docker run --runtime=nvidia --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $platformTarget $rid" -ForegroundColor Green docker run --runtime=nvidia --rm ` -v "$($DlibDotNetRoot):/opt/data/DlibDotNet" ` -e "LOCAL_UID=$(id -u $env:USER)" ` @@ -95,7 +96,7 @@ foreach($BuildTarget in $BuildTargets) } else { - Write-Host "Start docker run --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $OperatingSystem $OperatingSystemVersion" -ForegroundColor Green + Write-Host "Start docker run --rm -v ""$($DlibDotNetRoot):/opt/data/DlibDotNet"" -e LOCAL_UID=$(id -u $env:USER) -e LOCAL_GID=$(id -g $env:USER) -t ""$dockername"" $Version $package $platformTarget $rid" -ForegroundColor Green docker run --rm ` -v "$($DlibDotNetRoot):/opt/data/DlibDotNet" ` -e "LOCAL_UID=$(id -u $env:USER)" ` diff --git a/nuget/TestPackageUniversalWindowsPlatform.ps1 b/nuget/TestPackageUniversalWindowsPlatform.ps1 index 5a416565..e564ff3f 100644 --- a/nuget/TestPackageUniversalWindowsPlatform.ps1 +++ b/nuget/TestPackageUniversalWindowsPlatform.ps1 @@ -21,9 +21,15 @@ Param([Parameter( $CertificateKeyFile, [Parameter( - Mandatory=$False, + Mandatory=$True, Position = 4 )][string] + $CertificatePassword, + + [Parameter( + Mandatory=$False, + Position = 5 + )][string] $NotCountAsFailTests ) @@ -38,7 +44,7 @@ $NugetPath = Join-Path $DlibDotNetRoot "nuget" $OperatingSystem="windows" $OperatingSystemVersion="10" $TargetTestProject = "DlibDotNet.UWP.Tests.csproj" -$MSBuildDir = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64" +$MSBuildDir = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64" $AppcertDir = "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" $BuildTargets = @() $BuildTargets += New-Object PSObject -Property @{ Target = "cpu"; Architecture = "x64"; CUDA = 0; Package = "DlibDotNet.UWP" } @@ -117,6 +123,7 @@ function Build([string]$Architecture, [string]$OutputDir, [string]$Thumbprint, [ $command += " /p:AppxBundlePlatforms=""${Architecture}""" $command += " /p:AppxPackageSigningEnabled=true" $command += " /p:PackageCertificateThumbprint=${Thumbprint}" + $command += " /p:PackageCertificatePassword=${CertificatePassword}" $command += " /p:PackageCertificateKeyFile=""${CertificateKeyFile}""" Invoke-Expression "cmd.exe /c $command" diff --git a/nuget/TestPackageWindows.ps1 b/nuget/TestPackageWindows.ps1 index 9b90e002..176214e2 100644 --- a/nuget/TestPackageWindows.ps1 +++ b/nuget/TestPackageWindows.ps1 @@ -26,6 +26,7 @@ $BuildTargets += New-Object PSObject -Property @{Package = "DlibDotNet.CUDA100"; $BuildTargets += New-Object PSObject -Property @{Package = "DlibDotNet.CUDA101"; PlatformTarget="x64"; RID = "$OperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Package = "DlibDotNet.CUDA102"; PlatformTarget="x64"; RID = "$OperatingSystem-x64"; } $BuildTargets += New-Object PSObject -Property @{Package = "DlibDotNet.CUDA110"; PlatformTarget="x64"; RID = "$OperatingSystem-x64"; } +$BuildTargets += New-Object PSObject -Property @{Package = "DlibDotNet.CUDA111"; PlatformTarget="x64"; RID = "$OperatingSystem-x64"; } foreach($BuildTarget in $BuildTargets) { diff --git a/nuget/artifacts/cuda-111/runtimes/centos-x64/lib/.keepfolder b/nuget/artifacts/cuda-111/runtimes/centos-x64/lib/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/artifacts/cuda-111/runtimes/centos-x64/native/.keepfolder b/nuget/artifacts/cuda-111/runtimes/centos-x64/native/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/artifacts/cuda-111/runtimes/linux-x64/lib/.keepfolder b/nuget/artifacts/cuda-111/runtimes/linux-x64/lib/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/artifacts/cuda-111/runtimes/linux-x64/native/.keepfolder b/nuget/artifacts/cuda-111/runtimes/linux-x64/native/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/artifacts/cuda-111/runtimes/osx-x64/lib/.keepfolder b/nuget/artifacts/cuda-111/runtimes/osx-x64/lib/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/artifacts/cuda-111/runtimes/osx-x64/native/.keepfolder b/nuget/artifacts/cuda-111/runtimes/osx-x64/native/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/artifacts/cuda-111/runtimes/win-x64/lib/.keepfolder b/nuget/artifacts/cuda-111/runtimes/win-x64/lib/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/artifacts/cuda-111/runtimes/win-x64/native/.keepfolder b/nuget/artifacts/cuda-111/runtimes/win-x64/native/.keepfolder new file mode 100644 index 00000000..e69de29b diff --git a/nuget/nuspec/DlibDotNet.CPU.nuspec b/nuget/nuspec/DlibDotNet.CPU.nuspec index d774c142..cb23ba7f 100644 --- a/nuget/nuspec/DlibDotNet.CPU.nuspec +++ b/nuget/nuspec/DlibDotNet.CPU.nuspec @@ -2,7 +2,7 @@ DlibDotNet - 19.20.0.20200725 + 19.21.0.20201122 DlibDotNet Takuya Takeuchi Takuya Takeuchi diff --git a/nuget/nuspec/DlibDotNet.CUDA-100.nuspec b/nuget/nuspec/DlibDotNet.CUDA-100.nuspec index 33ca8456..9c8eeefb 100644 --- a/nuget/nuspec/DlibDotNet.CUDA-100.nuspec +++ b/nuget/nuspec/DlibDotNet.CUDA-100.nuspec @@ -2,7 +2,7 @@ DlibDotNet.CUDA100 - 19.20.0.20200725 + 19.21.0.20201122 DlibDotNet for CUDA 10.0 Takuya Takeuchi Takuya Takeuchi diff --git a/nuget/nuspec/DlibDotNet.CUDA-101.nuspec b/nuget/nuspec/DlibDotNet.CUDA-101.nuspec index 51fb454d..dab97f7b 100644 --- a/nuget/nuspec/DlibDotNet.CUDA-101.nuspec +++ b/nuget/nuspec/DlibDotNet.CUDA-101.nuspec @@ -2,7 +2,7 @@ DlibDotNet.CUDA101 - 19.20.0.20200725 + 19.21.0.20201122 DlibDotNet for CUDA 10.1 Takuya Takeuchi Takuya Takeuchi diff --git a/nuget/nuspec/DlibDotNet.CUDA-102.nuspec b/nuget/nuspec/DlibDotNet.CUDA-102.nuspec index 1119ddc3..3363aa61 100644 --- a/nuget/nuspec/DlibDotNet.CUDA-102.nuspec +++ b/nuget/nuspec/DlibDotNet.CUDA-102.nuspec @@ -2,7 +2,7 @@ DlibDotNet.CUDA102 - 19.20.0.20200725 + 19.21.0.20201122 DlibDotNet for CUDA 10.2 Takuya Takeuchi Takuya Takeuchi diff --git a/nuget/nuspec/DlibDotNet.CUDA-110.nuspec b/nuget/nuspec/DlibDotNet.CUDA-110.nuspec index 541a44cf..a5fce010 100644 --- a/nuget/nuspec/DlibDotNet.CUDA-110.nuspec +++ b/nuget/nuspec/DlibDotNet.CUDA-110.nuspec @@ -2,7 +2,7 @@ DlibDotNet.CUDA110 - 19.18.0.20200525 + 19.21.0.20201122 DlibDotNet for CUDA 11.0 Takuya Takeuchi Takuya Takeuchi diff --git a/nuget/nuspec/DlibDotNet.CUDA-111.nuspec b/nuget/nuspec/DlibDotNet.CUDA-111.nuspec new file mode 100644 index 00000000..35123eb0 --- /dev/null +++ b/nuget/nuspec/DlibDotNet.CUDA-111.nuspec @@ -0,0 +1,53 @@ + + + + DlibDotNet.CUDA111 + 19.21.0.20201122 + DlibDotNet for CUDA 11.1 + Takuya Takeuchi + Takuya Takeuchi + true + LICENSE.txt + https://github.com/takuya-takeuchi/DlibDotNet + https://github.com/takuya-takeuchi/DlibDotNet/blob/master/nuget/ml128.png?raw=true + Dlib wrapper library written in C++ and C# for Windows, MacOS and Linux + +Requirements: Visual C++ 2017 Redistributable Package and cudnn 8 + + © Takuya Takeuchi 2017-2020 + dlib .net machinelearning + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuget/nuspec/DlibDotNet.CUDA-92.nuspec b/nuget/nuspec/DlibDotNet.CUDA-92.nuspec index e2e38631..73c80b9f 100644 --- a/nuget/nuspec/DlibDotNet.CUDA-92.nuspec +++ b/nuget/nuspec/DlibDotNet.CUDA-92.nuspec @@ -2,7 +2,7 @@ DlibDotNet.CUDA92 - 19.20.0.20200725 + 19.21.0.20201122 DlibDotNet for CUDA 9.2 Takuya Takeuchi Takuya Takeuchi diff --git a/nuget/nuspec/DlibDotNet.MKL.nuspec b/nuget/nuspec/DlibDotNet.MKL.nuspec index 0c1a3495..960a5c25 100644 --- a/nuget/nuspec/DlibDotNet.MKL.nuspec +++ b/nuget/nuspec/DlibDotNet.MKL.nuspec @@ -2,7 +2,7 @@ DlibDotNet.MKL - 19.20.0.20200725 + 19.21.0.20201122 DlibDotNet for MKL Takuya Takeuchi Takuya Takeuchi diff --git a/nuget/nuspec/DlibDotNet.UWP.nuspec b/nuget/nuspec/DlibDotNet.UWP.nuspec index 57dda5f0..bf9aa8f1 100644 --- a/nuget/nuspec/DlibDotNet.UWP.nuspec +++ b/nuget/nuspec/DlibDotNet.UWP.nuspec @@ -2,7 +2,7 @@ DlibDotNet.UWP - 19.20.0.20200725 + 19.21.0.20201122 DlibDotNet for UWP Takuya Takeuchi Takuya Takeuchi diff --git a/src/DlibDotNet.Native.Dnn/Build.ps1 b/src/DlibDotNet.Native.Dnn/Build.ps1 index 2fbdf3bb..66eb4aac 100644 --- a/src/DlibDotNet.Native.Dnn/Build.ps1 +++ b/src/DlibDotNet.Native.Dnn/Build.ps1 @@ -5,7 +5,7 @@ #%3: Architecture (32/64) #%4: Platform (desktop,android/ios/uwp) #%5: Optional Argument -# if Target is cuda, CUDA version if Target is cuda [90/91/92/100/101/102/110] +# if Target is cuda, CUDA version if Target is cuda [90/91/92/100/101/102/110/111] # if Target is mkl and Windows, IntelMKL directory path #*************************************** Param diff --git a/src/DlibDotNet.Native.Dnn/CMakeLists.txt b/src/DlibDotNet.Native.Dnn/CMakeLists.txt index 15fc4b51..394c3432 100644 --- a/src/DlibDotNet.Native.Dnn/CMakeLists.txt +++ b/src/DlibDotNet.Native.Dnn/CMakeLists.txt @@ -4,7 +4,8 @@ cmake_policy(SET CMP0054 NEW) set(PROJ_NAME DlibDotNetNativeDnn) -project(${PROJ_NAME} VERSION 19.18.0) +# It means that CMakeLists.txt version rather than library version +project(${PROJ_NAME} VERSION 1.0.0) # OS info message("-------------------------------------------------------") @@ -22,9 +23,9 @@ message("-------------------------------------------------------") # Version info set(VERSION_MAJOR 19) -set(VERSION_MINOR 20) +set(VERSION_MINOR 21) set(VERSION_PATCH 0) -set(VERSION_DATE 20200725) +set(VERSION_DATE 20201122) # Only GCC requires -fPIC if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") diff --git a/src/DlibDotNet.Native/Build.ps1 b/src/DlibDotNet.Native/Build.ps1 index 2fbdf3bb..66eb4aac 100644 --- a/src/DlibDotNet.Native/Build.ps1 +++ b/src/DlibDotNet.Native/Build.ps1 @@ -5,7 +5,7 @@ #%3: Architecture (32/64) #%4: Platform (desktop,android/ios/uwp) #%5: Optional Argument -# if Target is cuda, CUDA version if Target is cuda [90/91/92/100/101/102/110] +# if Target is cuda, CUDA version if Target is cuda [90/91/92/100/101/102/110/111] # if Target is mkl and Windows, IntelMKL directory path #*************************************** Param diff --git a/src/DlibDotNet.Native/CMakeLists.txt b/src/DlibDotNet.Native/CMakeLists.txt index 0dc0ca09..ab66843c 100644 --- a/src/DlibDotNet.Native/CMakeLists.txt +++ b/src/DlibDotNet.Native/CMakeLists.txt @@ -4,7 +4,8 @@ cmake_policy(SET CMP0054 NEW) set(PROJ_NAME DlibDotNetNative) -project(${PROJ_NAME} VERSION 19.18.0) +# It means that CMakeLists.txt version rather than library version +project(${PROJ_NAME} VERSION 1.0.0) # OS info message("-------------------------------------------------------") @@ -22,9 +23,9 @@ message("-------------------------------------------------------") # Version info set(VERSION_MAJOR 19) -set(VERSION_MINOR 20) +set(VERSION_MINOR 21) set(VERSION_PATCH 0) -set(VERSION_DATE 20200725) +set(VERSION_DATE 20201122) # libjpeg-dev, libpng-dev set(DLIB_JPEG_SUPPORT True) diff --git a/src/DlibDotNet.Native/dlib/image_loader/load_png.h b/src/DlibDotNet.Native/dlib/image_loader/load_png.h index 038d3b2a..b8902729 100644 --- a/src/DlibDotNet.Native/dlib/image_loader/load_png.h +++ b/src/DlibDotNet.Native/dlib/image_loader/load_png.h @@ -14,12 +14,15 @@ using namespace std; #define load_png_template(__TYPE__, error, type, ...) \ dlib::load_png(*((array2d<__TYPE__>*)image), std::string(file_name, file_name_length)); +#define load_png_from_buffer_template(__TYPE__, error, type, ...) \ +dlib::load_png(*((array2d<__TYPE__>*)image), image_buffer, image_buffer_length); + #pragma endregion template DLLEXPORT int load_png(array2d_type type, void* image, const char* file_name, - const int file_name_length, + const uint32_t file_name_length, std::string** error_message) { int error = ERR_OK; @@ -42,4 +45,30 @@ DLLEXPORT int load_png(array2d_type type, return error; } +DLLEXPORT int load_png_from_buffer(array2d_type type, + void* image, + const uint8_t* image_buffer, + const uint32_t image_buffer_length, + std::string** error_message) +{ + int error = ERR_OK; + + try + { + array2d_template(type, + error, + load_png_from_buffer_template, + image, + image_buffer, + image_buffer_length); + } + catch(dlib::image_load_error& e) + { + error = ERR_GENERAL_IMAGE_LOAD; + *error_message = new std::string(e.what()); + } + + return error; +} + #endif \ No newline at end of file diff --git a/src/DlibDotNet/Dlib.cs b/src/DlibDotNet/Dlib.cs index d9c5c161..3e6e6c10 100644 --- a/src/DlibDotNet/Dlib.cs +++ b/src/DlibDotNet/Dlib.cs @@ -440,12 +440,42 @@ public static Array2D LoadPng(string path) var array2DType = image.ImageType.ToNativeArray2DType(); var ret = NativeMethods.load_png(array2DType, image.NativePtr, str, str.Length, out var errorMessage); - switch (ret) - { - case NativeMethods.ErrorType.Array2DTypeTypeNotSupport: - throw new ArgumentException($"{image.ImageType} is not supported."); - case NativeMethods.ErrorType.GeneralFileImageLoad: - throw new ImageLoadException(path, StringHelper.FromStdString(errorMessage)); + switch (ret) + { + case NativeMethods.ErrorType.Array2DTypeTypeNotSupport: + throw new ArgumentException($"{image.ImageType} is not supported."); + case NativeMethods.ErrorType.GeneralFileImageLoad: + throw new ImageLoadException(path, StringHelper.FromStdString(errorMessage)); + } + + return image; + } + + /// + /// This function loads PNG (Portable Network Graphics) file into an . + /// + /// The type of element in the image. + /// A byte array that contains png image data from which to create the . + /// The this method creates. + /// The specified type of image is not supported. + /// is null. + /// Failed to load image on dlib. + public static Array2D LoadPng(byte[] png) + where T : struct + { + if (png == null) + throw new ArgumentNullException(nameof(png)); + + var image = new Array2D(); + + var array2DType = image.ImageType.ToNativeArray2DType(); + var ret = NativeMethods.load_png_from_buffer(array2DType, image.NativePtr, png, png.Length, out var errorMessage); + switch (ret) + { + case NativeMethods.ErrorType.Array2DTypeTypeNotSupport: + throw new ArgumentException($"{image.ImageType} is not supported."); + case NativeMethods.ErrorType.GeneralFileImageLoad: + throw new ImageLoadException(StringHelper.FromStdString(errorMessage)); } return image; diff --git a/src/DlibDotNet/ImageLoadException.cs b/src/DlibDotNet/ImageLoadException.cs index 422fa05b..376df250 100644 --- a/src/DlibDotNet/ImageLoadException.cs +++ b/src/DlibDotNet/ImageLoadException.cs @@ -11,6 +11,11 @@ public sealed class ImageLoadException : Exception #region Constructors + internal ImageLoadException(string message) : + base(message) + { + } + internal ImageLoadException(string filepath, string message): base(message) { diff --git a/src/DlibDotNet/PInvoke/ImageLoader/LoadPng.cs b/src/DlibDotNet/PInvoke/ImageLoader/LoadPng.cs index 410bf902..e94d54a5 100644 --- a/src/DlibDotNet/PInvoke/ImageLoader/LoadPng.cs +++ b/src/DlibDotNet/PInvoke/ImageLoader/LoadPng.cs @@ -11,6 +11,9 @@ internal sealed partial class NativeMethods [DllImport(NativeLibrary, CallingConvention = CallingConvention)] public static extern ErrorType load_png(Array2DType type, IntPtr array, byte[] path, int pathLength, out IntPtr error_message); + [DllImport(NativeLibrary, CallingConvention = CallingConvention)] + public static extern ErrorType load_png_from_buffer(Array2DType type, IntPtr array, byte[] image, int imageLength, out IntPtr error_message); + } } \ No newline at end of file diff --git a/src/dlib b/src/dlib index 7b564927..9117bd78 160000 --- a/src/dlib +++ b/src/dlib @@ -1 +1 @@ -Subproject commit 7b564927d67775e25da96eee5c2354c0ed434677 +Subproject commit 9117bd784328d9ac40ffa1f9cf487633a8a715d7 diff --git a/test/DlibDotNet.Tests/DlibTest.cs b/test/DlibDotNet.Tests/DlibTest.cs index 19cb3e90..60b0a05e 100644 --- a/test/DlibDotNet.Tests/DlibTest.cs +++ b/test/DlibDotNet.Tests/DlibTest.cs @@ -803,6 +803,86 @@ public void LoadPng() } } + [Fact] + public void LoadPngFromBuffer() + { + const int cols = LoadTargetWidth; + const int rows = LoadTargetHeight; + var path = this.GetDataFile($"{LoadTarget}.png"); + + var tests = new[] + { + new { Type = ImageTypes.BgrPixel, ExpectResult = true}, + new { Type = ImageTypes.RgbPixel, ExpectResult = true}, + new { Type = ImageTypes.RgbAlphaPixel, ExpectResult = true}, + new { Type = ImageTypes.UInt8, ExpectResult = true}, + new { Type = ImageTypes.UInt16, ExpectResult = true}, + new { Type = ImageTypes.UInt32, ExpectResult = true}, + new { Type = ImageTypes.Int8, ExpectResult = true}, + new { Type = ImageTypes.Int16, ExpectResult = true}, + new { Type = ImageTypes.Int32, ExpectResult = true}, + new { Type = ImageTypes.HsiPixel, ExpectResult = true}, + new { Type = ImageTypes.LabPixel, ExpectResult = true}, + new { Type = ImageTypes.Float, ExpectResult = true}, + new { Type = ImageTypes.Double, ExpectResult = true} + }; + + var png = File.ReadAllBytes(path.FullName); + foreach (var test in tests) + { + TwoDimensionObjectBase image; + switch (test.Type) + { + case ImageTypes.BgrPixel: + image = Dlib.LoadPng(png); + break; + case ImageTypes.RgbPixel: + image = Dlib.LoadPng(png); + break; + case ImageTypes.RgbAlphaPixel: + image = Dlib.LoadPng(png); + break; + case ImageTypes.UInt8: + image = Dlib.LoadPng(png); + break; + case ImageTypes.UInt16: + image = Dlib.LoadPng(png); + break; + case ImageTypes.UInt32: + image = Dlib.LoadPng(png); + break; + case ImageTypes.Int8: + image = Dlib.LoadPng(png); + break; + case ImageTypes.Int16: + image = Dlib.LoadPng(png); + break; + case ImageTypes.Int32: + image = Dlib.LoadPng(png); + break; + case ImageTypes.HsiPixel: + image = Dlib.LoadPng(png); + break; + case ImageTypes.LabPixel: + image = Dlib.LoadPng(png); + break; + case ImageTypes.Float: + image = Dlib.LoadPng(png); + break; + case ImageTypes.Double: + image = Dlib.LoadPng(png); + break; + default: + throw new ArgumentOutOfRangeException(); + } + + Assert.True(image.Columns == cols, $"Failed to load {test.Type}."); + Assert.True(image.Rows == rows, $"Failed to load {test.Type}."); + + this.DisposeAndCheckDisposedState(image); + } + } + #endregion #region SaveBmp diff --git a/test/DlibDotNet.UWP.Tests/DlibDotNet.UWP.Tests.csproj b/test/DlibDotNet.UWP.Tests/DlibDotNet.UWP.Tests.csproj index e1ac08ca..f6bcd6f3 100644 --- a/test/DlibDotNet.UWP.Tests/DlibDotNet.UWP.Tests.csproj +++ b/test/DlibDotNet.UWP.Tests/DlibDotNet.UWP.Tests.csproj @@ -11,7 +11,7 @@ DlibDotNet.UWP.Tests ja-JP UAP - 10.0.17134.0 + 10.0.18362.0 10.0.17134.0 14 512 @@ -139,10 +139,10 @@ - 19.17.0.20190730-pre + 19.21.0.20201122 - 6.2.8 + 6.2.11