Skip to content

Commit

Permalink
Visual Studio improvements (II) (#29)
Browse files Browse the repository at this point in the history
* hiprtc: vs: copy additional libraries to output directory

Besides hiprtc*.dll, hiprtc-builtins*.dll and amd_comgr*.dll is also required.

In this commit, the PostBuildAction is also replaced by a Content statement. This
provides more robustness in the build system, as using this method there will be
no race conditions if two targets copy the same file to the output directory.

* Resolve "Multi-GPU error occured while hip_opengl_interop sample application is executed"
  • Loading branch information
Snektron authored Mar 7, 2023
1 parent e45bb34 commit d20eff9
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 56 deletions.
1 change: 0 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ test:rocm-windows-vs2019:
- |-
$SkippedExamples = @(
"hip_vulkan_interop_vs2019.exe" # Graphical
"hip_opengl_interop_vs2019.exe" # Graphical
"hip_texture_management_vs2019.exe" # Hangs sometimes
"hip_hello_world_vs2019.exe" # Crashes (known driver issue)
)
Expand Down
10 changes: 6 additions & 4 deletions HIP-Basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ add_subdirectory(warp_shuffle)
find_package(glfw3)
find_package(Vulkan COMPONENTS glslangValidator)

if(NOT glfw3_FOUND)
message("GLFW not found, not building OpenGL interop example")
else()
add_subdirectory(opengl_interop)
if(NOT WIN32)
if(NOT glfw3_FOUND)
message("GLFW not found, not building OpenGL interop example")
else()
add_subdirectory(opengl_interop)
endif()
endif()

if(NOT glfw3_FOUND)
Expand Down
25 changes: 12 additions & 13 deletions HIP-Basic/runtime_compilation/runtime_compilation_vs2017.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
<ItemGroup>
<ClInclude Include="..\..\Common\example_utils.hpp" />
</ItemGroup>
<ItemGroup Condition="'$(PlatformToolset)'=='HIP_clang'">
<Content Include="$(HIPExecutablePath)\hiprtc*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(HIPExecutablePath)\hiprtc-builtins*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(HIPExecutablePath)\amd_comgr*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand Down Expand Up @@ -77,12 +88,6 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hiprtc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "$(HIP_PATH)\bin\hiprtc0504.dll" "$(OutDir)"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying hiprtc0504.dll</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' and '$(PlatformToolset)'=='HIP_nvcc'">
<ClCompile>
Expand Down Expand Up @@ -113,12 +118,6 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hiprtc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "$(HIP_PATH)bin\hiprtc0504.dll" "$(OutDir)"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying hiprtc0504.dll</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' and '$(PlatformToolset)'=='HIP_nvcc'">
<ClCompile>
Expand All @@ -142,4 +141,4 @@
<Import Condition="'$(PlatformToolset)'=='HIP_clang'" Project="$(VCTargetsPath)\AMD.HIP.Clang.Common.targets" />
<Import Condition="'$(PlatformToolset)'=='HIP_nvcc'" Project="$(VCTargetsPath)\AMD.HIP.Nvcc.Common.targets" />
</ImportGroup>
</Project>
</Project>
19 changes: 11 additions & 8 deletions HIP-Basic/runtime_compilation/runtime_compilation_vs2019.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
<ItemGroup>
<ClInclude Include="..\..\Common\example_utils.hpp" />
</ItemGroup>
<ItemGroup Condition="'$(PlatformToolset)'=='HIP_clang'">
<Content Include="$(HIPExecutablePath)\hiprtc*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(HIPExecutablePath)\hiprtc-builtins*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(HIPExecutablePath)\amd_comgr*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand Down Expand Up @@ -77,10 +88,6 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hiprtc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "$(HIP_PATH)\bin\hiprtc0504.dll" "$(OutDir)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying hiprtc0504.dll</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' and '$(PlatformToolset)'=='HIP_nvcc'">
<ClCompile>
Expand Down Expand Up @@ -111,10 +118,6 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hiprtc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "$(HIP_PATH)bin\hiprtc0504.dll" "$(OutDir)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying hiprtc0504.dll</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' and '$(PlatformToolset)'=='HIP_nvcc'">
<ClCompile>
Expand Down
21 changes: 12 additions & 9 deletions HIP-Basic/runtime_compilation/runtime_compilation_vs2022.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
<ItemGroup>
<ClInclude Include="..\..\Common\example_utils.hpp" />
</ItemGroup>
<ItemGroup Condition="'$(PlatformToolset)'=='HIP_clang'">
<Content Include="$(HIPExecutablePath)\hiprtc*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(HIPExecutablePath)\hiprtc-builtins*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(HIPExecutablePath)\amd_comgr*.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand Down Expand Up @@ -77,10 +88,6 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hiprtc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy "$(HIP_PATH)\bin\hiprtc0504.dll" "$(OutDir)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying hiprtc0504.dll</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64' and '$(PlatformToolset)'=='HIP_nvcc'">
<ClCompile>
Expand Down Expand Up @@ -111,10 +118,6 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hiprtc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy "$(HIP_PATH)bin\hiprtc0504.dll" "$(OutDir)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying hiprtc0504.dll</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64' and '$(PlatformToolset)'=='HIP_nvcc'">
<ClCompile>
Expand All @@ -138,4 +141,4 @@
<Import Condition="'$(PlatformToolset)'=='HIP_clang'" Project="$(VCTargetsPath)\AMD.HIP.Clang.Common.targets" />
<Import Condition="'$(PlatformToolset)'=='HIP_nvcc'" Project="$(VCTargetsPath)\AMD.HIP.Nvcc.Common.targets" />
</ImportGroup>
</Project>
</Project>
7 changes: 0 additions & 7 deletions ROCm-Examples-VS2017.sln
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saxpy_vs2017", "HIP-Basic\s
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "device_globals_vs2017", "HIP-Basic\device_globals\device_globals_vs2017.vcxproj", "{F6B4FC89-465A-455A-B1E9-FF4C8689E3F0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl_interop_vs2017", "HIP-Basic\opengl_interop\opengl_interop_vs2017.vcxproj", "{3A7B4351-9F76-4863-AEB3-2CA6D2FC3BEF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moving_average_vs2017", "HIP-Basic\moving_average\moving_average_vs2017.vcxproj", "{5AD84319-5C2E-4012-869F-FD579114B248}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "device_query_vs2017", "HIP-Basic\device_query\device_query_vs2017.vcxproj", "{A9E1C716-820C-4B29-B36E-4F0AB057F09F}"
Expand Down Expand Up @@ -270,10 +268,6 @@ Global
{F6B4FC89-465A-455A-B1E9-FF4C8689E3F0}.Debug|x64.Build.0 = Debug|x64
{F6B4FC89-465A-455A-B1E9-FF4C8689E3F0}.Release|x64.ActiveCfg = Release|x64
{F6B4FC89-465A-455A-B1E9-FF4C8689E3F0}.Release|x64.Build.0 = Release|x64
{3A7B4351-9F76-4863-AEB3-2CA6D2FC3BEF}.Debug|x64.ActiveCfg = Debug|x64
{3A7B4351-9F76-4863-AEB3-2CA6D2FC3BEF}.Debug|x64.Build.0 = Debug|x64
{3A7B4351-9F76-4863-AEB3-2CA6D2FC3BEF}.Release|x64.ActiveCfg = Release|x64
{3A7B4351-9F76-4863-AEB3-2CA6D2FC3BEF}.Release|x64.Build.0 = Release|x64
{5AD84319-5C2E-4012-869F-FD579114B248}.Debug|x64.ActiveCfg = Debug|x64
{5AD84319-5C2E-4012-869F-FD579114B248}.Debug|x64.Build.0 = Debug|x64
{5AD84319-5C2E-4012-869F-FD579114B248}.Release|x64.ActiveCfg = Release|x64
Expand Down Expand Up @@ -386,7 +380,6 @@ Global
{61585EE3-7D6B-48EA-BB00-50878CD11604} = {8DF2222B-5CDB-44DE-AC5D-D24C6C0B0B49}
{1945EF9B-6E3C-4B44-A5D4-C88074402AAF} = {8DF2222B-5CDB-44DE-AC5D-D24C6C0B0B49}
{F6B4FC89-465A-455A-B1E9-FF4C8689E3F0} = {8DF2222B-5CDB-44DE-AC5D-D24C6C0B0B49}
{3A7B4351-9F76-4863-AEB3-2CA6D2FC3BEF} = {8DF2222B-5CDB-44DE-AC5D-D24C6C0B0B49}
{5AD84319-5C2E-4012-869F-FD579114B248} = {8DF2222B-5CDB-44DE-AC5D-D24C6C0B0B49}
{A9E1C716-820C-4B29-B36E-4F0AB057F09F} = {8DF2222B-5CDB-44DE-AC5D-D24C6C0B0B49}
{66B01CD4-735E-4E83-9DEF-E7EE88546E8F} = {8DF2222B-5CDB-44DE-AC5D-D24C6C0B0B49}
Expand Down
7 changes: 0 additions & 7 deletions ROCm-Examples-VS2019.sln
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "device_globals_vs2019", "HI
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moving_average_vs2019", "HIP-Basic\moving_average\moving_average_vs2019.vcxproj", "{628390E3-DB62-4D52-9594-DE6BC15F9943}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl_interop_vs2019", "HIP-Basic\opengl_interop\opengl_interop_vs2019.vcxproj", "{96F8BE41-5C64-4BF2-8A8E-474BEAACAA5A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_host_library_vs2019", "HIP-Basic\static_host_library\static_host_library_vs2019.vcxproj", "{5F8A7FEE-3A79-4588-9244-8575748026F7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhip_static_host_vs2019", "HIP-Basic\static_host_library\library\libhip_static_host_vs2019.vcxproj", "{6D3F8F78-225E-490E-ABD3-762857EBF597}"
Expand Down Expand Up @@ -266,10 +264,6 @@ Global
{628390E3-DB62-4D52-9594-DE6BC15F9943}.Debug|x64.Build.0 = Debug|x64
{628390E3-DB62-4D52-9594-DE6BC15F9943}.Release|x64.ActiveCfg = Release|x64
{628390E3-DB62-4D52-9594-DE6BC15F9943}.Release|x64.Build.0 = Release|x64
{96F8BE41-5C64-4BF2-8A8E-474BEAACAA5A}.Debug|x64.ActiveCfg = Debug|x64
{96F8BE41-5C64-4BF2-8A8E-474BEAACAA5A}.Debug|x64.Build.0 = Debug|x64
{96F8BE41-5C64-4BF2-8A8E-474BEAACAA5A}.Release|x64.ActiveCfg = Release|x64
{96F8BE41-5C64-4BF2-8A8E-474BEAACAA5A}.Release|x64.Build.0 = Release|x64
{5F8A7FEE-3A79-4588-9244-8575748026F7}.Debug|x64.ActiveCfg = Debug|x64
{5F8A7FEE-3A79-4588-9244-8575748026F7}.Debug|x64.Build.0 = Debug|x64
{5F8A7FEE-3A79-4588-9244-8575748026F7}.Release|x64.ActiveCfg = Release|x64
Expand Down Expand Up @@ -380,7 +374,6 @@ Global
{306EB993-653A-45F6-863A-5F43BC86DA79} = {6EB7144D-2707-489E-A043-D59B7BE006D1}
{F7DD9451-B0CA-4C76-AB92-0E01CBEBDBBE} = {6EB7144D-2707-489E-A043-D59B7BE006D1}
{628390E3-DB62-4D52-9594-DE6BC15F9943} = {6EB7144D-2707-489E-A043-D59B7BE006D1}
{96F8BE41-5C64-4BF2-8A8E-474BEAACAA5A} = {6EB7144D-2707-489E-A043-D59B7BE006D1}
{5F8A7FEE-3A79-4588-9244-8575748026F7} = {6EB7144D-2707-489E-A043-D59B7BE006D1}
{6D3F8F78-225E-490E-ABD3-762857EBF597} = {6EB7144D-2707-489E-A043-D59B7BE006D1}
{547B99C2-CBE3-4E1F-A1D6-26E261D67A3E} = {6EB7144D-2707-489E-A043-D59B7BE006D1}
Expand Down
7 changes: 0 additions & 7 deletions ROCm-Examples-VS2022.sln
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saxpy_vs2022", "HIP-Basic\s
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "device_globals_vs2022", "HIP-Basic\device_globals\device_globals_vs2022.vcxproj", "{3C13D642-960A-4F99-84A9-5559BCE3B347}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl_interop_vs2022", "HIP-Basic\opengl_interop\opengl_interop_vs2022.vcxproj", "{4111D437-C931-44E1-A45D-407FAFD3C444}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moving_average_vs2022", "HIP-Basic\moving_average\moving_average_vs2022.vcxproj", "{0851BA21-FFDB-4E7A-B798-4DBAADB94B8E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "device_query_vs2022", "HIP-Basic\device_query\device_query_vs2022.vcxproj", "{428C7C0B-C055-4126-A6D2-1E51344E5D40}"
Expand Down Expand Up @@ -270,10 +268,6 @@ Global
{3C13D642-960A-4F99-84A9-5559BCE3B347}.Debug|x64.Build.0 = Debug|x64
{3C13D642-960A-4F99-84A9-5559BCE3B347}.Release|x64.ActiveCfg = Release|x64
{3C13D642-960A-4F99-84A9-5559BCE3B347}.Release|x64.Build.0 = Release|x64
{4111D437-C931-44E1-A45D-407FAFD3C444}.Debug|x64.ActiveCfg = Debug|x64
{4111D437-C931-44E1-A45D-407FAFD3C444}.Debug|x64.Build.0 = Debug|x64
{4111D437-C931-44E1-A45D-407FAFD3C444}.Release|x64.ActiveCfg = Release|x64
{4111D437-C931-44E1-A45D-407FAFD3C444}.Release|x64.Build.0 = Release|x64
{0851BA21-FFDB-4E7A-B798-4DBAADB94B8E}.Debug|x64.ActiveCfg = Debug|x64
{0851BA21-FFDB-4E7A-B798-4DBAADB94B8E}.Debug|x64.Build.0 = Debug|x64
{0851BA21-FFDB-4E7A-B798-4DBAADB94B8E}.Release|x64.ActiveCfg = Release|x64
Expand Down Expand Up @@ -386,7 +380,6 @@ Global
{BE0294B1-C162-4877-B7A5-4CA9BB73146B} = {94393B51-B70E-4111-A22C-6A752D41E454}
{4579D781-7CA9-470C-A76C-5903369C40E8} = {94393B51-B70E-4111-A22C-6A752D41E454}
{3C13D642-960A-4F99-84A9-5559BCE3B347} = {94393B51-B70E-4111-A22C-6A752D41E454}
{4111D437-C931-44E1-A45D-407FAFD3C444} = {94393B51-B70E-4111-A22C-6A752D41E454}
{0851BA21-FFDB-4E7A-B798-4DBAADB94B8E} = {94393B51-B70E-4111-A22C-6A752D41E454}
{428C7C0B-C055-4126-A6D2-1E51344E5D40} = {94393B51-B70E-4111-A22C-6A752D41E454}
{8F2ECE57-1E5F-4175-8A7A-8B5F12663D68} = {94393B51-B70E-4111-A22C-6A752D41E454}
Expand Down

0 comments on commit d20eff9

Please sign in to comment.