mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-23 19:32:23 +00:00
Move one function from cuda_provider_factory.h (#8407)
This commit is contained in:
parent
3e7fcd8c92
commit
cc9f793b48
14 changed files with 13 additions and 50 deletions
|
|
@ -71,13 +71,6 @@
|
|||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(OnnxRuntimeCsharpRoot)\..\include\onnxruntime\core\providers\cuda\cuda_provider_factory.h"
|
||||
Condition="'$(OrtPackageId)' != 'Microsoft.ML.OnnxRuntime.DirectML'"
|
||||
PackagePath="\build\native\include"
|
||||
Pack="false"
|
||||
CopyToOutputDirectory="Never"
|
||||
Visible="false"
|
||||
/>
|
||||
<None Include="$(OnnxRuntimeCsharpRoot)\..\include\onnxruntime\core\providers\dml\dml_provider_factory.h"
|
||||
Condition="'$(OrtPackageId)' == 'Microsoft.ML.OnnxRuntime.DirectML'"
|
||||
PackagePath="\build\native\include"
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ int main(int argc, char* argv[]) {
|
|||
Ort::SessionOptions session_options;
|
||||
session_options.SetIntraOpNumThreads(1);
|
||||
|
||||
// If onnxruntime.dll is built with CUDA enabled, we can uncomment out this line to use CUDA for this
|
||||
// session (we also need to include cuda_provider_factory.h above which defines it)
|
||||
// #include "cuda_provider_factory.h"
|
||||
// If onnxruntime.dll is built with CUDA enabled, we can uncomment out this line to use CUDA for this session
|
||||
// OrtSessionOptionsAppendExecutionProvider_CUDA(session_options, 1);
|
||||
|
||||
// Sets graph optimization level
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ int main(int argc, char* argv[]) {
|
|||
g_ort->SetSessionGraphOptimizationLevel(session_options, ORT_ENABLE_BASIC);
|
||||
|
||||
// Optionally add more execution providers via session_options
|
||||
// E.g. for CUDA include cuda_provider_factory.h and uncomment the following line:
|
||||
// E.g. for CUDA uncomment the following line:
|
||||
// OrtSessionOptionsAppendExecutionProvider_CUDA(sessionOptions, 0);
|
||||
|
||||
//*************************************************************************
|
||||
|
|
|
|||
|
|
@ -1502,6 +1502,14 @@ struct OrtCustomOp {
|
|||
OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetOutputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the old way to add the CUDA provider to the session, please use SessionOptionsAppendExecutionProvider_CUDA above to access the latest functionality
|
||||
* This function always exists, but will only succeed if Onnxruntime was built with CUDA support and the CUDA provider shared library exists
|
||||
*
|
||||
* \param device_id cuda device id, starts from zero.
|
||||
*/
|
||||
ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
// Providers
|
||||
#include "onnxruntime/core/providers/cpu/cpu_provider_factory.h"
|
||||
#include "onnxruntime/core/providers/cuda/cuda_provider_factory.h"
|
||||
#include "onnxruntime/core/providers/dnnl/dnnl_provider_factory.h"
|
||||
#include "onnxruntime/core/providers/nnapi/nnapi_provider_factory.h"
|
||||
#include "onnxruntime/core/providers/nuphar/nuphar_provider_factory.h"
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
// Licensed under the MIT License.
|
||||
|
||||
#include "onnxruntime_c_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "core/framework/provider_options.h"
|
||||
|
||||
namespace onnxruntime {
|
||||
|
|
@ -18,8 +16,6 @@ namespace cuda {
|
|||
class INcclService;
|
||||
}
|
||||
|
||||
} // namespace onnxruntime
|
||||
|
||||
struct ProviderInfo_CUDA {
|
||||
virtual OrtStatus* SetCurrentGpuDeviceId(_In_ int device_id) = 0;
|
||||
virtual OrtStatus* GetCurrentGpuDeviceId(_In_ int* device_id) = 0;
|
||||
|
|
@ -48,14 +44,4 @@ struct ProviderInfo_CUDA {
|
|||
virtual std::shared_ptr<onnxruntime::IAllocator> CreateCudaAllocator(int16_t device_id, size_t gpu_mem_limit, onnxruntime::ArenaExtendStrategy arena_extend_strategy, onnxruntime::CUDAExecutionProviderExternalAllocatorInfo& external_allocator_info, OrtArenaCfg* default_memory_arena_cfg) = 0;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \param device_id cuda device id, starts from zero.
|
||||
*/
|
||||
ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
} // namespace onnxruntime
|
||||
|
|
@ -40,10 +40,6 @@
|
|||
#include "ortcustomops.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_CUDA
|
||||
#include "core/providers/cuda/cuda_provider_factory.h"
|
||||
#endif
|
||||
|
||||
using namespace onnxruntime::logging;
|
||||
using onnxruntime::BFloat16;
|
||||
using onnxruntime::DataTypeImpl;
|
||||
|
|
|
|||
|
|
@ -160,9 +160,7 @@ void ort_trt_run_with_default_options() {
|
|||
Ort::SessionOptions session_options;
|
||||
session_options.SetIntraOpNumThreads(1);
|
||||
|
||||
// If onnxruntime.dll is built with CUDA enabled, we can uncomment out this line to use CUDA for this
|
||||
// session (we also need to include cuda_provider_factory.h above which defines it)
|
||||
// #include "cuda_provider_factory.h"
|
||||
// If onnxruntime.dll is built with CUDA enabled, we can uncomment out this line to use CUDA for this session
|
||||
// OrtSessionOptionsAppendExecutionProvider_CUDA(session_options, 1);
|
||||
OrtSessionOptionsAppendExecutionProvider_Tensorrt(session_options, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@
|
|||
#include "core/session/onnxruntime_cxx_api.h"
|
||||
#include "onnxruntime_session_options_config_keys.h"
|
||||
#include "test/util/include/asserts.h"
|
||||
#ifdef USE_CUDA
|
||||
#include "core/providers/cuda/cuda_provider_factory.h"
|
||||
#endif
|
||||
#include <fstream>
|
||||
#include "test_fixture.h"
|
||||
#include "file_util.h"
|
||||
|
|
|
|||
|
|
@ -4,9 +4,6 @@
|
|||
#pragma once
|
||||
#include "core/providers/cpu/cpu_provider_factory.h"
|
||||
|
||||
#ifdef USE_CUDA
|
||||
#include "core/providers/cuda/cuda_provider_factory.h"
|
||||
#endif
|
||||
#ifdef USE_DNNL
|
||||
#include "core/providers/dnnl/dnnl_provider_factory.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ with open(args.output_source, 'w') as file:
|
|||
# WinML adapter should not be exported in platforms other than Windows.
|
||||
# Exporting OrtGetWinMLAdapter is exported without issues using .def file when compiling for Windows
|
||||
# so it isn't necessary to include it in generated_source.c
|
||||
if c != "winml":
|
||||
if c != "winml" and c != "cuda":
|
||||
file.write("#include <core/providers/%s/%s_provider_factory.h>\n" % (c, c))
|
||||
file.write("void* GetFunctionEntryByName(const char* name){\n")
|
||||
for symbol in symbols:
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ steps:
|
|||
copy $(Build.SourcesDirectory)\include\onnxruntime\core\session\onnxruntime_*.h $(Build.BinariesDirectory)\${{parameters.artifactName}}\include
|
||||
copy $(Build.SourcesDirectory)\include\onnxruntime\core\framework\provider_options.h $(Build.BinariesDirectory)\${{parameters.artifactName}}\include
|
||||
copy $(Build.SourcesDirectory)\include\onnxruntime\core\providers\cpu\cpu_provider_factory.h $(Build.BinariesDirectory)\${{parameters.artifactName}}\include
|
||||
copy $(Build.SourcesDirectory)\include\onnxruntime\core\providers\cuda\cuda_provider_factory.h $(Build.BinariesDirectory)\${{parameters.artifactName}}\include
|
||||
|
||||
REM copy the README, licence and TPN
|
||||
copy $(Build.SourcesDirectory)\README.md $(Build.BinariesDirectory)\${{parameters.artifactName}}\README.md
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ cp $SOURCE_DIR/include/onnxruntime/core/session/onnxruntime_c_api.h $BINARY_DIR
|
|||
cp $SOURCE_DIR/include/onnxruntime/core/session/onnxruntime_cxx_api.h $BINARY_DIR/$ARTIFACT_NAME/include
|
||||
cp $SOURCE_DIR/include/onnxruntime/core/session/onnxruntime_cxx_inline.h $BINARY_DIR/$ARTIFACT_NAME/include
|
||||
cp $SOURCE_DIR/include/onnxruntime/core/providers/cpu/cpu_provider_factory.h $BINARY_DIR/$ARTIFACT_NAME/include
|
||||
cp $SOURCE_DIR/include/onnxruntime/core/providers/cuda/cuda_provider_factory.h $BINARY_DIR/$ARTIFACT_NAME/include
|
||||
cp $SOURCE_DIR/include/onnxruntime/core/session/onnxruntime_session_options_config_keys.h $BINARY_DIR/$ARTIFACT_NAME/include
|
||||
cp $SOURCE_DIR/include/onnxruntime/core/session/onnxruntime_run_options_config_keys.h $BINARY_DIR/$ARTIFACT_NAME/include
|
||||
cp $SOURCE_DIR/include/onnxruntime/core/framework/provider_options.h $BINARY_DIR/$ARTIFACT_NAME/include
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ def generate_files(list, args):
|
|||
is_dml_package = args.package_name == 'Microsoft.ML.OnnxRuntime.DirectML'
|
||||
is_windowsai_package = args.package_name == 'Microsoft.AI.MachineLearning'
|
||||
|
||||
includes_cuda = is_cuda_gpu_package or is_cpu_package # Why does the CPU package ship the cuda provider headers?
|
||||
includes_winml = is_windowsai_package
|
||||
includes_directml = (is_dml_package or is_windowsai_package) and not args.is_store_build and (
|
||||
args.target_architecture == 'x64' or args.target_architecture == 'x86')
|
||||
|
|
@ -246,12 +245,6 @@ def generate_files(list, args):
|
|||
'include\\onnxruntime\\core\\providers\\cpu\\cpu_provider_factory.h') +
|
||||
'" target="build\\native\\include" />')
|
||||
|
||||
if includes_cuda:
|
||||
files_list.append('<file src=' + '"' +
|
||||
os.path.join(args.sources_path,
|
||||
'include\\onnxruntime\\core\\providers\\cuda\\cuda_provider_factory.h') +
|
||||
'" target="build\\native\\include" />')
|
||||
|
||||
if args.execution_provider == 'openvino':
|
||||
files_list.append('<file src=' + '"' +
|
||||
os.path.join(args.sources_path,
|
||||
|
|
|
|||
Loading…
Reference in a new issue