Skip to content
Draft
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
80 changes: 66 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,83 @@
**/Makefile
**/obj
**/*.log
/cache
# =============================================================================
# Orochi — .gitignore
# =============================================================================

# -----------------------------------------------------------------------------
# Build outputs
# -----------------------------------------------------------------------------
build/
dist/**
!dist/*sh
!dist/*.sh
!dist/resultReference

*.json
*.filters
*.sdf
*.bc
# Object files and intermediate
**/obj/
*.o
*.obj
*.lo
*.dSYM/

# Binaries
*.exe
*.out
*.app
*.dll
*.so
*.dylib
*.a
*.lib

!Resources/**
# -----------------------------------------------------------------------------
# C/C++ artifacts
# -----------------------------------------------------------------------------
*.d
*.pch
*.gch
*.pdb
*.ilk
*.exp
*.idb
*.bc
*.fatbin

# -----------------------------------------------------------------------------
# Premake / IDE generated files
# -----------------------------------------------------------------------------
**/Makefile
*.vcxproj
*.user
*.vcxproj.filters
*.vcxproj.user
*.sln
*.sdf
*.opendb
*.def
.DS_Store

# -----------------------------------------------------------------------------
# Visual Studio
# -----------------------------------------------------------------------------
.vs/
build/
*.suo
*.ncb
*.aps

# -----------------------------------------------------------------------------
# macOS
# -----------------------------------------------------------------------------
.DS_Store

# -----------------------------------------------------------------------------
# Logs and test results
# -----------------------------------------------------------------------------
**/*.log
result.xml
tahoePy.log

# -----------------------------------------------------------------------------
# Project-specific caches
# -----------------------------------------------------------------------------
/cache/
UnitTest/bitcodes/*.fatbin
Test/SimpleD3D12/cache/**

ParallelPrimitives/cache/KernelArgs.h
ParallelPrimitives/cache/Kernels.h
ParallelPrimitives/cache/oro_compiled_kernels.h
138 changes: 51 additions & 87 deletions Orochi/enable_cuew.lua
Original file line number Diff line number Diff line change
@@ -1,107 +1,71 @@


--
-- In order to have Orochi compiled with CUDA, you need to define OROCHI_ENABLE_CUEW, and add the CUDA include path to your Orochi project.
--
-- If your project is using premake, this script can be included:
-- it helps to configure your Orochi project
--
--
--


function oropremake_joinPaths(basePath, additionalPath)
-- Detect the path separator based on the operating system
local pathSeparator = package.config:sub(1,1)
-- Check if the basePath already ends with a path separator
if basePath:sub(-1) ~= pathSeparator then
basePath = basePath .. pathSeparator
end
return basePath .. additionalPath
-- =============================================================================
-- Orochi CUDA/CUEW Configuration
-- =============================================================================
-- Enables CUEW (CUDA Extension Wrangler) when the CUDA SDK is available.
-- Include this file from the root premake5.lua to auto-detect CUDA.

-- -----------------------------------------------------------------------------
-- Utility functions
-- -----------------------------------------------------------------------------

local function isValidPath(p)
return p ~= nil and p ~= "" and os.isdir(p)
end

function oropremake_PathOK(inPath)
if ( inPath == nil or inPath == '' ) then
return false
end
if ( os.isdir(inPath) ) then
return true
end
return false
end



-- -----------------------------------------------------------------------------
-- CUDA path detection
-- -----------------------------------------------------------------------------

-- REGION GENERATED BY OROCHI SUMMONER
--REGION_PREMAKE_START CudaPath
-- Preferred CUDA version for this Orochi build
local cudaVersionName = "12.2"
local cudaEnvVar = "CUDA_PATH_V12_2"
local cudaPathLinux = "/usr/local/cuda-12.2"
local cudaPathWindows = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2"

best_cuda_version_name = "12.2"
best_cuda_envvar = "CUDA_PATH_V12_2"
best_cuda_path_linux = "/usr/local/cuda-12.2"
best_cuda_path_windows = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2"
backup_cuda_envvar = "CUDA_PATH"
backup_cuda_path_linux = "/usr/local/cuda"
-- Fallback paths
local backupCudaEnvVar = "CUDA_PATH"
local backupCudaLinux = "/usr/local/cuda"

--REGION_PREMAKE_END
-- Resolve CUDA SDK path (preferred version first, then fallback)
local cuda_path = os.getenv(cudaEnvVar)



--
-- first, try the best CUDA paths ( the one that matches the version use for this Orochi )
--

cuda_path = os.getenv(best_cuda_envvar)

-- if not found in envvar, try if path exist ( linux )
if (not oropremake_PathOK(cuda_path)) then
if ( os.isdir(best_cuda_path_linux) ) then
cuda_path = best_cuda_path_linux
end
if not isValidPath(cuda_path) and os.isdir(cudaPathLinux) then
cuda_path = cudaPathLinux
end

-- try the windows path
if (not oropremake_PathOK(cuda_path)) then
if ( os.isdir(best_cuda_path_windows) ) then
cuda_path = best_cuda_path_windows
end
if not isValidPath(cuda_path) and os.isdir(cudaPathWindows) then
cuda_path = cudaPathWindows
end

if (not oropremake_PathOK(cuda_path)) then
print("The requiered version of CUDA for this Orochi is not found: " .. best_cuda_version_name .. ". It's advised that you install this version.")
if not isValidPath(cuda_path) then
print("The required version of CUDA for this Orochi is not found: " .. cudaVersionName .. ". It's advised that you install this version.")
end

--
-- If CUDA still not found, search the "backup" paths
--

if (not oropremake_PathOK(cuda_path)) then
cuda_path = os.getenv(backup_cuda_envvar)
-- Try fallback paths
if not isValidPath(cuda_path) then
cuda_path = os.getenv(backupCudaEnvVar)
end

-- if the CUDA PATH is not in the env var, search in the classic folder
if (not oropremake_PathOK(cuda_path)) then
if ( os.isdir(backup_cuda_path_linux) ) then
cuda_path = backup_cuda_path_linux
end
if not isValidPath(cuda_path) and os.isdir(backupCudaLinux) then
cuda_path = backupCudaLinux
end

-- Enable CUEW if CUDA is forced or if we find the CUDA SDK folder
if ( _OPTIONS["forceCuda"] or oropremake_PathOK(cuda_path) ) then
print("CUEW is enabled.")
defines {"OROCHI_ENABLE_CUEW"}
-- -----------------------------------------------------------------------------
-- Apply CUDA configuration
-- -----------------------------------------------------------------------------

if _OPTIONS["forceCuda"] or isValidPath(cuda_path) then
print("CUEW is enabled.")
defines { "OROCHI_ENABLE_CUEW" }
end

-- If we find the CUDA SDK folder, add it to the include dir
if (not oropremake_PathOK(cuda_path)) then
if _OPTIONS["forceCuda"] then
print("WARNING: CUEW is enabled but it may not compile because CUDA SDK folder ( CUDA_PATH ) not found. You should install the CUDA SDK, or set CUDA_PATH.")
else
print("WARNING: CUEW is automatically disabled because CUDA SDK folder ( CUDA_PATH ) not found. You can force CUEW with the --forceCuda argument.")
end
if not isValidPath(cuda_path) then
if _OPTIONS["forceCuda"] then
print("WARNING: CUEW is enabled but it may not compile because CUDA SDK folder (CUDA_PATH) not found. You should install the CUDA SDK, or set CUDA_PATH.")
else
print("WARNING: CUEW is automatically disabled because CUDA SDK folder (CUDA_PATH) not found. You can force CUEW with the --forceCuda argument.")
end
else
print("CUDA SDK install folder found: " .. cuda_path)
includedirs { oropremake_joinPaths(cuda_path,"include") }
print("CUDA SDK install folder found: " .. cuda_path)
externalincludedirs { path.join(cuda_path, "include") }
end


17 changes: 7 additions & 10 deletions Test/DeviceEnum/premake5.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
project "DeviceEnum"
kind "ConsoleApp"
kind "ConsoleApp"

targetdir "../../dist/bin/%{cfg.buildcfg}"
location "../../build/"
location "%{wks.location}/Test/%{prj.name}"

if os.istarget("windows") then
links{ "version" }
end
linkVersionLib()

includedirs { "../../" }
files { "../../Orochi/Orochi.h", "../../Orochi/Orochi.cpp" }
files { "../../contrib/**.h", "../../contrib/**.cpp" }
files { "*.cpp" }
includedirs { "../../" }
files { "../../Orochi/Orochi.h", "../../Orochi/Orochi.cpp" }
files { "../../contrib/**.h", "../../contrib/**.cpp" }
files { "*.cpp" }
19 changes: 8 additions & 11 deletions Test/RadixSort/premake5.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
project "RadixSort"
kind "ConsoleApp"
kind "ConsoleApp"

targetdir "../../dist/bin/%{cfg.buildcfg}"
location "../../build/"
location "%{wks.location}/Test/%{prj.name}"

if os.istarget("windows") then
links{ "version" }
end
linkVersionLib()

includedirs { "../../" }
files { "../../Orochi/**.h", "../../Orochi/**.cpp" }
files { "../../contrib/**.h", "../../contrib/**.cpp" }
files { "*.cpp" }
files { "../../ParallelPrimitives/**.h", "../../ParallelPrimitives/**.cpp" }
includedirs { "../../" }
files { "../../Orochi/**.h", "../../Orochi/**.cpp" }
files { "../../contrib/**.h", "../../contrib/**.cpp" }
files { "*.cpp" }
files { "../../ParallelPrimitives/**.h", "../../ParallelPrimitives/**.cpp" }
74 changes: 39 additions & 35 deletions Test/SimpleD3D12/premake5.lua
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
project "simpleD3D12"
kind "WindowedApp"
kind "WindowedApp"

targetdir "../../dist/bin/%{cfg.buildcfg}"
location "../../build/"
debugdir "."
location "%{wks.location}/Test/%{prj.name}"
debugdir "."

buildoptions { "/wd4244" }
defines { "GTEST_HAS_TR1_TUPLE=0" }
-- links{ "Pop" }
libdirs{"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x64/"}
links{"d3d12", "d3dcompiler", "dxgi", "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32", "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32", "Version"}
includedirs { "../../" }
includedirs { "./" }

files {"../../contrib/cuew/src/cuew.cpp" }
buildoptions { "/wd4244" }
defines { "GTEST_HAS_TR1_TUPLE=0" }

files {"../../contrib/hipew/src/hipew.cpp" }
files {"DX12OroSample.cpp" }
files {"Main.cpp" }
files {"../../Orochi/Orochi.cpp" }
files {"../../Orochi/OrochiUtils.cpp" }
files {"Win32Application.cpp" }
files {"simpleD3D12.cpp" }
files {"stdafx.cpp" }
files {"../../contrib/cuew/include/cuew.h" }
libdirs { "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x64/" }
links {
"d3d12", "d3dcompiler", "dxgi",
"kernel32", "user32", "gdi32", "winspool", "comdlg32",
"advapi32", "shell32", "ole32", "oleaut32", "uuid",
"odbc32", "odbccp32", "Version"
}

files {"../../contrib/hipew/include/hipew.h" }
files {"DX12OroSample.h" }
files {"DXSampleHelper.h" }
files {"helper_string.h" }
files {"../../Orochi/Orochi.h" }
files {"../../Orochi/OrochiUtils.h" }
files {"ShaderStructs.h" }
files {"Win32Application.h" }
files {"d3dx12.h" }
--files {"shaders.hlsl" }
files {"simpleD3D12.h" }
files {"stdafx.h" }
files{"sinewave_Orochi.oro"}
includedirs { "../../" }
includedirs { "./" }

files {
"../../contrib/cuew/src/cuew.cpp",
"../../contrib/hipew/src/hipew.cpp",
"DX12OroSample.cpp",
"Main.cpp",
"../../Orochi/Orochi.cpp",
"../../Orochi/OrochiUtils.cpp",
"Win32Application.cpp",
"simpleD3D12.cpp",
"stdafx.cpp",
"../../contrib/cuew/include/cuew.h",
"../../contrib/hipew/include/hipew.h",
"DX12OroSample.h",
"DXSampleHelper.h",
"helper_string.h",
"../../Orochi/Orochi.h",
"../../Orochi/OrochiUtils.h",
"ShaderStructs.h",
"Win32Application.h",
"d3dx12.h",
"simpleD3D12.h",
"stdafx.h",
"sinewave_Orochi.oro"
}
Loading