Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions FastGPU-P/FastGPU-P.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<RootNamespace>FastGPU_P</RootNamespace>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
Expand All @@ -11,9 +11,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MetroModernUI" Version="1.4.0" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.1" />
<PackageReference Include="System.Management.Automation" Version="7.2.1" />
<PackageReference Include="MaterialSkin.2" Version="2.3.1" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.5.4" />
<PackageReference Include="System.Management.Automation" Version="7.5.4" />
</ItemGroup>

</Project>
11 changes: 6 additions & 5 deletions FastGPU-P/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 22 additions & 7 deletions FastGPU-P/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
using MetroFramework.Forms;
using MaterialSkin.Controls;
using MaterialSkin;
using System.Management.Automation;
using System.Diagnostics;
using System.Collections.ObjectModel;
using System.Management;

namespace FastGPU_P
{
public partial class Form1 : MetroForm
public partial class Form1 : MaterialForm
{
public Form1()
{
InitializeComponent();
// MaterialSkin manager setup
var materialSkinManager = MaterialSkinManager.Instance;
materialSkinManager.AddFormToManage(this);
materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
materialSkinManager.ColorScheme = new ColorScheme(
Primary.Blue600, Primary.Blue700,
Primary.Blue200, Accent.LightBlue200,
TextShade.WHITE
);
Shown += Form1_Shown;
}

private void Form1_Shown(Object sender, EventArgs e)
private void Form1_Shown(object? sender, EventArgs e)
{
int i = 0;

Expand Down Expand Up @@ -45,7 +55,7 @@ private void Form1_Shown(Object sender, EventArgs e)

}

private void allocationBar_Scroll(object sender, ScrollEventArgs e)
private void allocationBar_Scroll(object sender, EventArgs e)
{
this.allocLabel.Text = allocationBar.Value.ToString() + "%";
}
Expand Down Expand Up @@ -85,7 +95,8 @@ private void addButton_Click(object sender, EventArgs e)
}

string _scr = (@"
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
$oldPolicy = Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
$VMName = " + "\"" + vmBox.GetItemText(vmBox.Text) + "\"" + @"
$instance = " + "\"" + getGPUInstance(gpuBox.Text) + "\"" + @"
[decimal]$GPUResourceAllocationPercentage = " + allocationBar.Value.ToString() + @"
Expand All @@ -98,6 +109,7 @@ private void addButton_Click(object sender, EventArgs e)
Set-VM -GuestControlledCacheTypes $true -VMName $VMName
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName $VMName
Set-VM -HighMemoryMappedIoSpace 32GB -VMName $VMName
Set-ExecutionPolicy -ExecutionPolicy $oldPolicy -Scope Process
");
var _ps = PowerShell.Create();
_ps.AddScript(_scr);
Expand All @@ -116,7 +128,8 @@ private void installDriver()
{
//
string _scr = @"
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
$oldPolicy = Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
Import-Module Storage
Function Add-VMGpuPartitionAdapterFiles {
param(
Expand Down Expand Up @@ -229,6 +242,9 @@ Function Add-VMGpuPartitionAdapterFiles {
""Previous State was running so starting VM...""
Start-VM $VMName
}
";
_scr += @"
Set-ExecutionPolicy -ExecutionPolicy $oldPolicy -Scope Process
";
var _ps = PowerShell.Create();
_ps.AddScript(_scr);
Expand All @@ -241,7 +257,6 @@ Function Add-VMGpuPartitionAdapterFiles {
{
MessageBox.Show("GPU driver updated successfully!");
}
//
}

private void RemoveButton_Click(object sender, EventArgs e)
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,28 @@ A WIP GUI app to make GPU-P way easier!
Based on : https://github.com/jamesstringerparsec/Easy-GPU-PV
![image](https://github.com/user-attachments/assets/9b732ced-8304-4dc3-afa2-95c409702cfa)
# Usage
The usage is simple, choose VM, choose GPU, slide the percentage you want to allocate of it and then press Add.
For drivers, choose VM, and then click install/update driver. It will mount the VM's VHD, copy the driver files, and unmount the VHD.
Requires Visual Studio Code (exe can be provided but dont trust anything from the internet so use the code)

- Download all files and extract the zip
- Open visual Studio Code as Administrator (right click, run as administrator)
- File -> open folder and open the extracted folder
- Trust the files on the popup (as youve read through the code on github and happy its safe of course)
- Install c# dev kit and .net 10, it should popup when you open the folder asking you to do this

- In the terminal enter
dotnet build FastGPU-P/FastGPU-P.csproj
and press enter
- In the terminal enter
dotnet run --project FastGPU-P/FastGPU-P.csproj
and press enter

The GUI will now load

- Choose VM,
- Choose GPU,
- Slide the percentage you want to allocate of it and then press Add.
- Click install/update driver. It will mount the VM's VHD, copy the driver files, and unmount the VHD.

# Troubleshooting
If you get an error related to Execution Policy you should execute:
"Set-ExecutionPolicy -ExecutionPolicy Unrestricted" on PowerShell