Giter Club home page Giter Club logo

Comments (13)

skottmckay avatar skottmckay commented on June 29, 2024 2

May be simpler to use build.py as it would validate different combinations of parameters. It prints out the cmake command if you really really want to use that directly.

e.g. .\build.bat --enable_training --config RelWithDebInfo

from onnxruntime.

LaurentBerger avatar LaurentBerger commented on June 29, 2024 1

I manage to build with only cmake with this cmake parameters below.
I use this command and extract cmake variable in output:

.\build.bat --config RelWithDebInfo --build_shared_lib --parallel --enable_training_apis --cmake_extra_defines CMAKE_INSTALL_PREFIX=c:/install/onnxruntime_rwdi

Now I use
cmake --build . --config release
or
cmake --build . --config debug
or
cmake --build . --config RelWithDebInfo

It compile and link.

-DONNX_USE_MSVC_STATIC_RUNTIME=OFF \
-DONNX_USE_LITE_PROTO=ON \
-DONNX_GEN_PB_TYPE_STUBS=ON \
-DONNX_DISABLE_STATIC_REGISTRATION=OFF \
-Dprotobuf_BUILD_CONFORMANCE:BOOL=OFF \
-Dprotobuf_BUILD_EXAMPLES:BOOL=OFF \
-Dprotobuf_BUILD_LIBPROTOC:BOOL=OFF \
-Dprotobuf_BUILD_PROTOC_BINARIES:BOOL=ON \
-Dprotobuf_BUILD_SHARED_LIBS:BOOL=OFF \
-Dprotobuf_BUILD_TESTS:BOOL=OFF \
-Dprotobuf_DEBUG_POSTFIX:STRING=d \
-Dprotobuf_DISABLE_RTTI:BOOL=OFF \
-Dprotobuf_INSTALL:BOOL=ON \
-Dprotobuf_INSTALL_EXAMPLES:BOOL=OFF \
-Dprotobuf_IS_TOP_LEVEL:STATIC=OFF \
-Dprotobuf_MODULE_COMPATIBLE:BOOL=OFF \
-Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF \
-Dprotobuf_USE_EXTERNAL_GTEST:BOOL=ON \
-Dprotobuf_VERBOSE:BOOL=OFF \
-Dprotobuf_WITH_ZLIB:BOOL=ON \
-DProtobuf_USE_STATIC_LIBS=OFF \
-Dgtest_force_shared_crt=ON \
-Donnxruntime_ENABLE_PYTHON=ON \
-Donnxruntime_BUILD_CSHARP=OFF \
-Donnxruntime_BUILD_JAVA=OFF \
-Donnxruntime_BUILD_NODEJS=OFF \
-Donnxruntime_BUILD_OBJC=OFF \
-Donnxruntime_BUILD_SHARED_LIB=ON \
-Donnxruntime_BUILD_APPLE_FRAMEWORK=OFF \
-Donnxruntime_ENABLE_TRAINING=ON \
-Donnxruntime_ENABLE_TRAINING_OPS=ON \
-Donnxruntime_ENABLE_TRAINING_APIS=ON \
-Donnxruntime_USE_DNNL=OFF \
-Donnxruntime_USE_NNAPI_BUILTIN=OFF \
-Donnxruntime_USE_RKNPU=OFF \
-Donnxruntime_USE_LLVM=OFF \
-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF \
-Donnxruntime_USE_VITISAI=OFF \
-Donnxruntime_USE_TENSORRT=OFF \
-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=ON \
-Donnxruntime_USE_TVM=OFF \
-Donnxruntime_TVM_CUDA_RUNTIME=OFF \
-Donnxruntime_TVM_USE_HASH=OFF \
-Donnxruntime_USE_MIGRAPHX=OFF \
-Donnxruntime_DISABLE_CONTRIB_OPS=OFF \
-Donnxruntime_DISABLE_ML_OPS=OFF \
-Donnxruntime_DISABLE_EXCEPTIONS=OFF \
-Donnxruntime_MINIMAL_BUILD=OFF \
-Donnxruntime_EXTENDED_MINIMAL_BUILD=OFF \
-Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS=OFF \
-Donnxruntime_REDUCED_OPS_BUILD=OFF \
-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS=OFF \
-Donnxruntime_USE_DML=OFF \
-Donnxruntime_USE_WINML=OFF \
-Donnxruntime_BUILD_MS_EXPERIMENTAL_OPS=OFF \
-Donnxruntime_USE_TELEMETRY=OFF \
-Donnxruntime_ENABLE_LTO=OFF \
-Donnxruntime_ENABLE_PYTHON:BOOL=ON \
-Donnxruntime_USE_ACL=OFF \
-Donnxruntime_USE_ACL_1902=OFF \
-Donnxruntime_USE_ACL_1905=OFF \
-Donnxruntime_USE_ACL_1908=OFF \
-Donnxruntime_USE_ACL_2002=OFF \
-Donnxruntime_USE_ACL_2308=OFF \
-Donnxruntime_USE_ARMNN=OFF \
-Donnxruntime_ARMNN_RELU_USE_CPU=ON \
-Donnxruntime_ARMNN_BN_USE_CPU=ON \
-Donnxruntime_USE_JSEP=OFF \
-Donnxruntime_ENABLE_NVTX_PROFILE=OFF \
-Donnxruntime_ENABLE_CPU_FP16_OPS=ON \
-Donnxruntime_USE_NCCL=OFF \
-Donnxruntime_BUILD_BENCHMARKS=OFF \
-Donnxruntime_USE_ROCM=OFF \
-DOnnxruntime_GCOV_COVERAGE=OFF \
-Donnxruntime_USE_MPI=OFF \
-Donnxruntime_ENABLE_MEMORY_PROFILE=OFF \
-Donnxruntime_ENABLE_CUDA_LINE_NUMBER_INFO=OFF \
-Donnxruntime_USE_CUDA_NHWC_OPS=OFF \
-Donnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING=ON \
-Donnxruntime_ENABLE_WEBASSEMBLY_API_EXCEPTION_CATCHING=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_THROWING=ON \
-Donnxruntime_WEBASSEMBLY_RUN_TESTS_IN_BROWSER=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_PROFILING=OFF \
-Donnxruntime_ENABLE_LAZY_TENSOR=OFF \
-Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS=OFF \
-Donnxruntime_ENABLE_CUDA_PROFILING=OFF \
-Donnxruntime_ENABLE_ROCM_PROFILING=OFF \
-Donnxruntime_USE_XNNPACK=OFF \
-Donnxruntime_USE_WEBNN=OFF \
-Donnxruntime_USE_CANN=OFF \
-Donnxruntime_USE_TRITON_KERNEL=OFF \
-Donnxruntime_DISABLE_FLOAT8_TYPES=OFF \
-Donnxruntime_DISABLE_SPARSE_TENSORS=OFF \
-Donnxruntime_DISABLE_OPTIONAL_TYPE=OFF \
-Donnxruntime_USE_FULL_PROTOBUF:BOOL=OFF 

PS Who close issue?

from onnxruntime.

LaurentBerger avatar LaurentBerger commented on June 29, 2024

I tried with onnxruntime_DISABLE_RTTI=OFF:

cmake $sourceRepo/$repoName/cmake -DCMAKE_INSTALL_PREFIX=c:/install/onnxruntime \
-DZLIB_INCLUDE_DIR:PATH=${installRepo}/zlib/include -DZLIB_LIBRARY_DEBUG:FILEPATH=${installRepo}/zlib/lib/${zlibname}d.lib -DZLIB_LIBRARY_RELEASE:FILEPATH=${installRepo}/zlib/lib/${zlibname}.lib \
-Donnxruntime_BUILD_FOR_NATIVE_MACHINE=ON \
-Donnxruntime_ENABLE_TRAINING=ON \
-Donnxruntime_ENABLE_TRAINING_APIS=ON \
-Donnxruntime_ENABLE_LAZY_TENSOR=OFF \
-Donnxruntime_DISABLE_RTTI=OFF \
.

I have got errors( too many) but all relative to
`78>libprotobuf-lited.lib(message_lite.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj

`

from onnxruntime.

LaurentBerger avatar LaurentBerger commented on June 29, 2024

Ok now protobuf_BUILD_SHARED_LIBS=ON

cmake $sourceRepo/$repoName/cmake -DCMAKE_INSTALL_PREFIX=c:/install/onnxruntime \
-DZLIB_INCLUDE_DIR:PATH=${installRepo}/zlib/include -DZLIB_LIBRARY_DEBUG:FILEPATH=${installRepo}/zlib/lib/${zlibname}d.lib -DZLIB_LIBRARY_RELEASE:FILEPATH=${installRepo}/zlib/lib/${zlibname}.lib \
-Donnxruntime_BUILD_FOR_NATIVE_MACHINE=ON \
-Donnxruntime_ENABLE_TRAINING=ON \
-Donnxruntime_ENABLE_TRAINING_APIS=ON \
-Donnxruntime_ENABLE_LAZY_TENSOR=OFF \
-Donnxruntime_DISABLE_RTTI=OFF \
-Dprotobuf_BUILD_SHARED_LIBS=ON \
.

It works but there is no onnxruntime/include/onnxruntime/onnxruntime_cxx_api.h in install directory

from onnxruntime.

yuslepukhin avatar yuslepukhin commented on June 29, 2024

Your have -Donnxruntime_DISABLE_RTTI=OFF and this training code makes use of RTTI feature dynamic_cast.
RTTI OFF is typically needed to reduce the size of the binary to deploy it in constrained environments.
I am not familiar with the feature map for training, but it looks like a bug to me.

from onnxruntime.

LaurentBerger avatar LaurentBerger commented on June 29, 2024

Problem I can not find cmake paremter to build onnx with training for window
Here https://dev.azure.com/onnxruntime/2a773b67-e88b-4c7f-9fc0-87d31fea8ef2/_apis/build/builds/1390186/logs/15 no training
Here https://dev.azure.com/onnxruntime/2a773b67-e88b-4c7f-9fc0-87d31fea8ef2/_apis/build/builds/1389121/logs/16 with training but it is linux

from onnxruntime.

er3x3 avatar er3x3 commented on June 29, 2024

@pengwa Could you please help to take a look?

from onnxruntime.

LaurentBerger avatar LaurentBerger commented on June 29, 2024

May be simpler to use build.py as it would validate different combinations of parameters. It prints out the cmake command if you really really want to use that directly.

OK It works. (don't forget to delete all files and folder in build repo) I keep all cmake options given below.
But something is weird in install process. There is a training lib but I cannot find in install folder. I can't build this sample because there is no include file onnxruntime_training_api.h. May be I should open another issue

-DZLIB_INCLUDE_DIR:PATH=${installRepo}/zlib/include -DZLIB_LIBRARY_DEBUG:FILEPATH=${installRepo}/zlib/lib/${zlibname}d.lib -DZLIB_LIBRARY_RELEASE:FILEPATH=${installRepo}/zlib/lib/${zlibname}.lib \
-DABSL_ENABLE_INSTALL:BOOL=OFF \
-DABSL_FIND_GOOGLETEST:BOOL=ON \
-DABSL_USE_GOOGLETEST_HEAD:BOOL=OFF \
-DABSL_USE_SYSTEM_INCLUDES:BOOL=OFF \
-DBUILD_GMOCK:BOOL=ON \
-DBUILD_ONNX_PYTHON:BOOL=OFF \
-DBUILD_PKGCONFIG_FILES:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_TESTING:BOOL=ON \
-DBUILD_TZ_LIB:BOOL=OFF \
-DCLOG_BUILD_TESTS:BOOL=OFF \
-DCLOG_LOG_TO_STDIO:BOOL=ON \
-DCLOG_RUNTIME_TYPE:STRING=default \
-DCMAKE_INSTALL_PREFIX=c:/install/onnxruntime \
-DCOMPILE_WITH_C_LOCALE:BOOL=OFF \
-DCONFU_DEPENDENCIES_BINARY_DIR:PATH=C:/lib/onnxruntime/build/Windows/RelWithDebInfo/deps \
-DCONFU_DEPENDENCIES_SOURCE_DIR:PATH=C:/lib/onnxruntime/cmake/deps \
-DCPUINFO_BUILD_PKG_CONFIG:BOOL=ON \
-DCPUINFO_LIBRARY_TYPE:STRING=default \
-DCPUINFO_LOG_LEVEL:STRING=default \
-DCPUINFO_LOG_TO_STDIO:BOOL=ON \
-DCPUINFO_RUNTIME_TYPE:STRING=default \
-DCTEST_SUBMIT_RETRY_COUNT:STRING=3 \
-DCTEST_SUBMIT_RETRY_DELAY:STRING=5 \
-DCXXOPTS_BUILD_EXAMPLES:BOOL=OFF \
-DCXXOPTS_BUILD_TESTS:BOOL=OFF \
-DCXXOPTS_USE_UNICODE_HELP:BOOL=FALSE \
-DDART_BUILD_ERROR_REPORT_LIMIT:BOOL=OFF \
-DDART_BUILD_WARNING_REPORT_LIMIT:BOOL=OFF \
-DDART_TESTING_TIMEOUT:STRING=1500 \
-DDART_VERBOSE_BUILD:BOOL=OFF \
-DFAST_BUILD:BOOL=OFF \
-DFLATBUFFERS_BUILD_BENCHMARKS:BOOL=OFF \
-DFLATBUFFERS_BUILD_CPP17:BOOL=OFF \
-DFLATBUFFERS_BUILD_FLATC:BOOL=ON \
-DFLATBUFFERS_BUILD_FLATHASH:BOOL=OFF \
-DFLATBUFFERS_BUILD_FLATLIB:BOOL=ON \
-DFLATBUFFERS_BUILD_GRPCTEST:BOOL=OFF \
-DFLATBUFFERS_BUILD_LEGACY:BOOL=OFF \
-DFLATBUFFERS_BUILD_SHAREDLIB:BOOL=OFF \
-DFLATBUFFERS_BUILD_TESTS:BOOL=OFF \
-DFLATBUFFERS_CODE_COVERAGE:BOOL=OFF \
-DFLATBUFFERS_CODE_SANITIZE:BOOL=OFF \
-DFLATBUFFERS_ENABLE_PCH:BOOL=OFF \
-DFLATBUFFERS_INSTALL:BOOL=OFF \
-DFLATBUFFERS_LIBCXX_WITH_CLANG:BOOL=ON \
-DFLATBUFFERS_PACKAGE_DEBIAN:BOOL=OFF \
-DFLATBUFFERS_PACKAGE_REDHAT:BOOL=OFF \
-DFLATBUFFERS_SKIP_MONSTER_EXTRA:BOOL=OFF \
-DFLATBUFFERS_STATIC_FLATC:BOOL=OFF \
-DFLATBUFFERS_STRICT_MODE:BOOL=OFF \
-DGSL_INSTALL:BOOL=OFF \
-DGSL_IS_TOP_LEVEL:STATIC=OFF \
-DGSL_TEST:BOOL=OFF \
-DGSL_VS_ADD_NATIVE_VISUALIZERS:BOOL=ON \
-DGTEST_HAS_ABSL:BOOL=ON \
-DINSTALL_GTEST:BOOL=OFF \
-DONNX_BUILD_BENCHMARKS:BOOL=OFF \
-DONNX_BUILD_TESTS:BOOL=OFF \
-DONNX_COVERAGE:BOOL=OFF \
-DONNX_DISABLE_EXCEPTIONS:BOOL=OFF \
-DONNX_DISABLE_STATIC_REGISTRATION:BOOL=OFF \
-DONNX_GEN_PB_TYPE_STUBS:BOOL=ON \
-DONNX_USE_LITE_PROTO:BOOL=ON \
-DONNX_USE_MSVC_STATIC_RUNTIME:UNINITIALIZED=OFF \
-DONNX_USE_PROTOBUF_SHARED_LIBS:BOOL=OFF \
-DONNX_USE_UNITY_BUILD:BOOL=OFF \
-DONNX_VERIFY_PROTO3:BOOL=OFF \
-DONNX_WERROR:BOOL=OFF \
-DOnnxruntime_GCOV_COVERAGE:UNINITIALIZED=OFF \
-DPRINT_OPTION_CURR_BUILD_SHARED_LIBS:BOOL=OFF \
-DPRINT_OPTION_CURR_DISABLE_STRING_VIEW:BOOL=OFF \
-DPRINT_OPTION_CURR_ENABLE_DATE_TESTING:BOOL=OFF \
-DPRINT_OPTION_CURR_MANUAL_TZ_DB:BOOL=OFF \
-DPRINT_OPTION_CURR_USE_SYSTEM_TZ_DB:BOOL=ON \
-DPRINT_OPTION_CURR_USE_TZ_DB_IN_DOT:BOOL=OFF \
-DPYBIND11_FINDPYTHON:BOOL=OFF \
-DRE2_BUILD_FRAMEWORK:BOOL=OFF \
-DUSEPCRE:BOOL=OFF \
-DUSE_SYSTEM_GOOGLEBENCHMARK:BOOL=OFF \
-DUSE_SYSTEM_GOOGLETEST:BOOL=OFF \
-DUSE_SYSTEM_LIBS:BOOL=OFF \
-DUSE_SYSTEM_TZ_DB:BOOL=ON \
-DUSE_TZ_DB_IN_DOT:BOOL=OFF \
-DWIL_BUILD_PACKAGING:BOOL=OFF \
-DWIL_BUILD_TESTS:BOOL=OFF \
-Dgmock_build_tests:BOOL=OFF \
-Dgtest_build_samples:BOOL=OFF \
-Dgtest_build_tests:BOOL=OFF \
-Dgtest_disable_pthreads:BOOL=OFF \
-Dgtest_force_shared_crt:BOOL=ON \
-Dgtest_hide_internal_symbols:BOOL=OFF \
-Donnxruntime_ARMNN_BN_USE_CPU:BOOL=ON \
-Donnxruntime_ARMNN_RELU_USE_CPU:BOOL=ON \
-Donnxruntime_BUILD_BENCHMARKS:BOOL=OFF \
-Donnxruntime_BUILD_CACHE:BOOL=OFF \
-Donnxruntime_BUILD_CSHARP:BOOL=OFF \
-Donnxruntime_BUILD_FOR_NATIVE_MACHINE:BOOL=OFF \
-Donnxruntime_BUILD_JAVA:UNINITIALIZED=OFF \
-Donnxruntime_BUILD_KERNEL_EXPLORER:BOOL=OFF \
-Donnxruntime_BUILD_MS_EXPERIMENTAL_OPS:UNINITIALIZED=OFF \
-Donnxruntime_BUILD_NODEJS:UNINITIALIZED=OFF \
-Donnxruntime_BUILD_OBJC:BOOL=OFF \
-Donnxruntime_BUILD_OPSCHEMA_LIB:BOOL=ON \
-Donnxruntime_BUILD_SHARED_LIB:BOOL=OFF \
-Donnxruntime_BUILD_UNIT_TESTS:BOOL=OFF \
-Donnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB:BOOL=OFF \
-Donnxruntime_CROSS_COMPILING:BOOL=OFF \
-Donnxruntime_CUDA_MINIMAL:BOOL=OFF \
-Donnxruntime_DEBUG_NODE_INPUTS_OUTPUTS:BOOL=OFF \
-Donnxruntime_DISABLE_ABSEIL:BOOL=OFF \
-Donnxruntime_DISABLE_CONTRIB_OPS:BOOL=OFF \
-Donnxruntime_DISABLE_EXTERNAL_INITIALIZERS:BOOL=OFF \
-Donnxruntime_DISABLE_FLOAT8_TYPES:BOOL=OFF \
-Donnxruntime_DISABLE_ML_OPS:BOOL=OFF \
-Donnxruntime_DISABLE_OPTIONAL_TYPE:BOOL=OFF \
-Donnxruntime_DISABLE_SPARSE_TENSORS:BOOL=OFF \
-Donnxruntime_DONT_VECTORIZE:BOOL=OFF \
-Donnxruntime_ENABLE_ATEN:BOOL=OFF \
-Donnxruntime_ENABLE_BITCODE:BOOL=OFF \
-Donnxruntime_ENABLE_CPUINFO:BOOL=ON \
-Donnxruntime_ENABLE_CPU_FP16_OPS:BOOL=ON \
-Donnxruntime_ENABLE_CUDA_LINE_NUMBER_INFO:BOOL=OFF \
-Donnxruntime_ENABLE_CUDA_PROFILING:BOOL=OFF \
-Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS:BOOL=OFF \
-Donnxruntime_ENABLE_INSTRUMENT:BOOL=OFF \
-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS:BOOL=OFF \
-Donnxruntime_ENABLE_LAZY_TENSOR:BOOL=OFF \
-Donnxruntime_ENABLE_LTO:BOOL=OFF \
-Donnxruntime_ENABLE_MEMLEAK_CHECKER:BOOL=OFF \
-Donnxruntime_ENABLE_MEMORY_PROFILE:BOOL=OFF \
-Donnxruntime_ENABLE_MICROSOFT_INTERNAL:BOOL=OFF \
-Donnxruntime_ENABLE_NVTX_PROFILE:BOOL=OFF \
-Donnxruntime_ENABLE_PYTHON:BOOL=ON \
-Donnxruntime_ENABLE_ROCM_PROFILING:BOOL=OFF \
-Donnxruntime_ENABLE_STATIC_ANALYSIS:BOOL=OFF \
-Donnxruntime_ENABLE_TRAINING:BOOL=ON \
-Donnxruntime_ENABLE_TRAINING_APIS:BOOL=ON \
-Donnxruntime_ENABLE_TRAINING_E2E_TESTS:BOOL=OFF \
-Donnxruntime_ENABLE_TRAINING_OPS:BOOL=ON \
-Donnxruntime_ENABLE_TRITON:BOOL=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_API_EXCEPTION_CATCHING:BOOL=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO:BOOL=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING:BOOL=ON \
-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_THROWING:BOOL=ON \
-Donnxruntime_ENABLE_WEBASSEMBLY_OUTPUT_OPTIMIZED_MODEL:BOOL=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_PROFILING:BOOL=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS:BOOL=OFF \
-Donnxruntime_EXTENDED_MINIMAL_BUILD:BOOL=OFF \
-Donnxruntime_EXTENSIONS_OVERRIDDEN,:BOOL=OFF \
-Donnxruntime_EXTERNAL_TRANSFORMER_SRC_PATH:BOOL=OFF \
-Donnxruntime_FUZZ_TEST:BOOL=OFF \
-Donnxruntime_GCOV_COVERAGE:BOOL=OFF \
-Donnxruntime_GENERATE_TEST_REPORTS:BOOL=ON \
-Donnxruntime_MINIMAL_BUILD:BOOL=OFF \
-Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS:BOOL=OFF \
-Donnxruntime_PREBUILT_PYTORCH_PATH:BOOL=OFF \
-Donnxruntime_REDIRECT_STATIC_ANALYSIS_OUTPUTS_TO_FILE:BOOL=OFF \
-Donnxruntime_REDUCED_OPS_BUILD:BOOL=OFF \
-Donnxruntime_RUN_MODELTEST_IN_DEBUG_MODE:BOOL=OFF \
-Donnxruntime_RUN_ONNX_TESTS:BOOL=OFF \
-Donnxruntime_TVM_CUDA_RUNTIME:BOOL=OFF \
-Donnxruntime_TVM_USE_HASH:BOOL=OFF \
-Donnxruntime_TVM_USE_LLVM:BOOL=OFF \
-Donnxruntime_USE_ACL:BOOL=OFF \
-Donnxruntime_USE_ACL_1902:BOOL=OFF \
-Donnxruntime_USE_ACL_1905:BOOL=OFF \
-Donnxruntime_USE_ACL_1908:BOOL=OFF \
-Donnxruntime_USE_ACL_2002:BOOL=OFF \
-Donnxruntime_USE_ACL_2308:BOOL=OFF \
-Donnxruntime_USE_ARMNN:BOOL=OFF \
-Donnxruntime_USE_AVX:BOOL=OFF \
-Donnxruntime_USE_AVX2:BOOL=OFF \
-Donnxruntime_USE_AVX512:BOOL=OFF \
-Donnxruntime_USE_AZURE:BOOL=OFF \
-Donnxruntime_USE_CANN:BOOL=OFF \
-Donnxruntime_USE_COMPOSABLE_KERNEL:BOOL=ON \
-Donnxruntime_USE_COREML:BOOL=OFF \
-Donnxruntime_USE_CUDA:BOOL=OFF \
-Donnxruntime_USE_CUDA_NHWC_OPS:BOOL=OFF \
-Donnxruntime_USE_CUSTOM_STATIC_ANALYSIS_RULES:BOOL=OFF \
-Donnxruntime_USE_DML:BOOL=OFF \
-Donnxruntime_USE_DNNL:BOOL=OFF \
-Donnxruntime_USE_EXTENSIONS:BOOL=OFF \
-Donnxruntime_USE_FULL_PROTOBUF:BOOL=OFF \
-Donnxruntime_USE_JSEP:BOOL=OFF \
-Donnxruntime_USE_LLVM:BOOL=OFF \
-Donnxruntime_USE_LOCK_FREE_QUEUE:BOOL=OFF \
-Donnxruntime_USE_MEMORY_EFFICIENT_ATTENTION:BOOL=ON \
-Donnxruntime_USE_MIGRAPHX:BOOL=OFF \
-Donnxruntime_USE_MIMALLOC:BOOL=OFF \
-Donnxruntime_USE_MPI:BOOL=OFF \
-Donnxruntime_USE_NCCL:BOOL=OFF \
-Donnxruntime_USE_NEURAL_SPEED:BOOL=OFF \
-Donnxruntime_USE_NNAPI_BUILTIN:BOOL=OFF \
-Donnxruntime_USE_OPENVINO:BOOL=OFF \
-Donnxruntime_USE_PREINSTALLED_EIGEN:BOOL=OFF \
-Donnxruntime_USE_QNN:BOOL=OFF \
-Donnxruntime_USE_RKNPU:BOOL=OFF \
-Donnxruntime_USE_ROCBLAS_EXTENSION_API:BOOL=OFF \
-Donnxruntime_USE_ROCM:BOOL=OFF \
-Donnxruntime_USE_SNPE:BOOL=OFF \
-Donnxruntime_USE_TELEMETRY:BOOL=OFF \
-Donnxruntime_USE_TENSORRT:BOOL=OFF \
-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER:BOOL=ON \
-Donnxruntime_USE_TRITON_KERNEL:BOOL=OFF \
-Donnxruntime_USE_TVM:BOOL=OFF \
-Donnxruntime_USE_VALGRIND:BOOL=OFF \
-Donnxruntime_USE_VITISAI:BOOL=OFF \
-Donnxruntime_USE_WEBNN:BOOL=OFF \
-Donnxruntime_USE_WINML:BOOL=OFF \
-Donnxruntime_USE_XNNPACK:BOOL=OFF \
-Donnxruntime_WEBASSEMBLY_RUN_TESTS_IN_BROWSER:BOOL=OFF \
-Dprotobuf_BUILD_CONFORMANCE:BOOL=OFF \
-Dprotobuf_BUILD_EXAMPLES:BOOL=OFF \
-Dprotobuf_BUILD_LIBPROTOC:BOOL=OFF \
-Dprotobuf_BUILD_PROTOC_BINARIES:BOOL=ON \
-Dprotobuf_BUILD_SHARED_LIBS:BOOL=OFF \
-Dprotobuf_BUILD_TESTS:BOOL=OFF \
-Dprotobuf_DEBUG_POSTFIX:STRING=d \
-Dprotobuf_DISABLE_RTTI:BOOL=OFF \
-Dprotobuf_INSTALL:BOOL=ON \
-Dprotobuf_INSTALL_EXAMPLES:BOOL=OFF \
-Dprotobuf_MODULE_COMPATIBLE:BOOL=OFF \
-Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF \
-Dprotobuf_USE_EXTERNAL_GTEST:BOOL=ON \
-Dprotobuf_VERBOSE:BOOL=OFF \
-Dutf8_range_ENABLE_INSTALL:BOOL=OFF \
-Dutf8_range_ENABLE_TESTS:BOOL=OFF \

from onnxruntime.

LaurentBerger avatar LaurentBerger commented on June 29, 2024

It seems that -Donnxruntime_ENABLE_PYTHON:BOOL=ON make /GR option and when it is OFF /GR- and give error C4541
A smaller version :

-DBUILD_ONNX_PYTHON:BOOL=OFF \
-Donnxruntime_ENABLE_PYTHON:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DCMAKE_INSTALL_PREFIX=c:/install/onnxruntime \
-DFLATBUFFERS_BUILD_SHAREDLIB:BOOL=OFF \
-DFLATBUFFERS_STATIC_FLATC:BOOL=OFF \
-DONNX_DISABLE_EXCEPTIONS:BOOL=OFF \
-DONNX_USE_LITE_PROTO:BOOL=ON \
-DONNX_USE_MSVC_STATIC_RUNTIME:BOOL=OFF \
-DONNX_USE_PROTOBUF_SHARED_LIBS:BOOL=OFF \
-Donnxruntime_BUILD_BENCHMARKS:BOOL=OFF \
-Donnxruntime_BUILD_CACHE:BOOL=OFF \
-Donnxruntime_BUILD_CSHARP:BOOL=OFF \
-Donnxruntime_BUILD_JAVA:BOOL=OFF \
-Donnxruntime_BUILD_KERNEL_EXPLORER:BOOL=OFF \
-Donnxruntime_BUILD_MS_EXPERIMENTAL_OPS:BOOL=OFF \
-Donnxruntime_BUILD_NODEJS:BOOL=OFF \
-Donnxruntime_BUILD_OBJC:BOOL=OFF \
-Donnxruntime_BUILD_OPSCHEMA_LIB:BOOL=ON \
-Donnxruntime_BUILD_SHARED_LIB:BOOL=OFF \
-Donnxruntime_BUILD_UNIT_TESTS:BOOL=OFF \
-Donnxruntime_CROSS_COMPILING:BOOL=OFF \
-Donnxruntime_DEBUG_NODE_INPUTS_OUTPUTS:BOOL=OFF \
-Donnxruntime_DISABLE_SPARSE_TENSORS:BOOL=OFF \
-Donnxruntime_DONT_VECTORIZE:BOOL=OFF \
-Donnxruntime_ENABLE_ATEN:BOOL=OFF \
-Donnxruntime_ENABLE_BITCODE:BOOL=OFF \
-Donnxruntime_ENABLE_CPUINFO:BOOL=ON \
-Donnxruntime_ENABLE_CPU_FP16_OPS:BOOL=ON \
-Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS:BOOL=OFF \
-Donnxruntime_ENABLE_INSTRUMENT:BOOL=OFF \
-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS:BOOL=OFF \
-Donnxruntime_ENABLE_LAZY_TENSOR:BOOL=OFF \
-Donnxruntime_ENABLE_LTO:BOOL=OFF \
-Donnxruntime_ENABLE_MEMLEAK_CHECKER:BOOL=OFF \
-Donnxruntime_ENABLE_MEMORY_PROFILE:BOOL=OFF \
-Donnxruntime_ENABLE_MICROSOFT_INTERNAL:BOOL=OFF \
-Donnxruntime_ENABLE_NVTX_PROFILE:BOOL=OFF \
-Donnxruntime_ENABLE_PYTHON:BOOL=ON \
-Donnxruntime_ENABLE_ROCM_PROFILING:BOOL=OFF \
-Donnxruntime_ENABLE_STATIC_ANALYSIS:BOOL=OFF \
-Donnxruntime_ENABLE_TRAINING:BOOL=ON \
-Donnxruntime_ENABLE_TRAINING_APIS:BOOL=ON \
-Donnxruntime_ENABLE_TRAINING_E2E_TESTS:BOOL=OFF \
-Donnxruntime_ENABLE_TRAINING_OPS:BOOL=ON \
-Donnxruntime_ENABLE_TRITON:BOOL=OFF \
-Donnxruntime_EXTENDED_MINIMAL_BUILD:BOOL=OFF \
-Donnxruntime_EXTERNAL_TRANSFORMER_SRC_PATH:BOOL=OFF \
-Donnxruntime_FUZZ_TEST:BOOL=OFF \
-Donnxruntime_MINIMAL_BUILD:BOOL=OFF \
-Donnxruntime_REDUCED_OPS_BUILD:BOOL=OFF \
-Donnxruntime_RUN_ONNX_TESTS:BOOL=OFF \
-Donnxruntime_USE_ACL:BOOL=OFF \
-Dprotobuf_BUILD_SHARED_LIBS:BOOL=OFF \
-Dprotobuf_DEBUG_POSTFIX:STRING=d \
-Dprotobuf_DISABLE_RTTI:BOOL=OFF \
-Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF \

from onnxruntime.

pengwa avatar pengwa commented on June 29, 2024

I cannot repro the issue with following command:

".\build.bat --use_cuda --config=Debug --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8" --cudnn_home="C:\ProgramData\NVIDIA GPU Computing Toolkit\cudnn-windows-x86_64-8.5.0.96_cuda11-archive" --update --build --cuda_version=11.8 --parallel --cmake_generator "Visual Studio 17 2022" --enable_training
"

Is there any tooling version different with yours?

from onnxruntime.

pengwa avatar pengwa commented on June 29, 2024

May be simpler to use build.py as it would validate different combinations of parameters. It prints out the cmake command if you really really want to use that directly.

e.g. .\build.bat --enable_training --config RelWithDebInfo

Could you please use build.bat to build the training wheel (protected by our CIs), and see whether it have similar issue.

from onnxruntime.

LaurentBerger avatar LaurentBerger commented on June 29, 2024

I manage to build with only cmake with this cmake parameters below.
I use this command and extract cmake variable in output:

.\build.bat --config RelWithDebInfo --build_shared_lib --parallel --enable_training_apis --cmake_extra_defines CMAKE_INSTALL_PREFIX=c:/install/onnxruntime_rwdi

Now I use
cmake --build . --config release
or
cmake --build . --config debug
or
cmake --build . --config RelWithDebInfo

It compile and link.

-DONNX_USE_MSVC_STATIC_RUNTIME=OFF \
-DONNX_USE_LITE_PROTO=ON \
-DONNX_GEN_PB_TYPE_STUBS=ON \
-DONNX_DISABLE_STATIC_REGISTRATION=OFF \
-Dprotobuf_BUILD_CONFORMANCE:BOOL=OFF \
-Dprotobuf_BUILD_EXAMPLES:BOOL=OFF \
-Dprotobuf_BUILD_LIBPROTOC:BOOL=OFF \
-Dprotobuf_BUILD_PROTOC_BINARIES:BOOL=ON \
-Dprotobuf_BUILD_SHARED_LIBS:BOOL=OFF \
-Dprotobuf_BUILD_TESTS:BOOL=OFF \
-Dprotobuf_DEBUG_POSTFIX:STRING=d \
-Dprotobuf_DISABLE_RTTI:BOOL=OFF \
-Dprotobuf_INSTALL:BOOL=ON \
-Dprotobuf_INSTALL_EXAMPLES:BOOL=OFF \
-Dprotobuf_IS_TOP_LEVEL:STATIC=OFF \
-Dprotobuf_MODULE_COMPATIBLE:BOOL=OFF \
-Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF \
-Dprotobuf_USE_EXTERNAL_GTEST:BOOL=ON \
-Dprotobuf_VERBOSE:BOOL=OFF \
-Dprotobuf_WITH_ZLIB:BOOL=ON \
-DProtobuf_USE_STATIC_LIBS=OFF \
-Dgtest_force_shared_crt=ON \
-Donnxruntime_ENABLE_PYTHON=ON \
-Donnxruntime_BUILD_CSHARP=OFF \
-Donnxruntime_BUILD_JAVA=OFF \
-Donnxruntime_BUILD_NODEJS=OFF \
-Donnxruntime_BUILD_OBJC=OFF \
-Donnxruntime_BUILD_SHARED_LIB=ON \
-Donnxruntime_BUILD_APPLE_FRAMEWORK=OFF \
-Donnxruntime_ENABLE_TRAINING=ON \
-Donnxruntime_ENABLE_TRAINING_OPS=ON \
-Donnxruntime_ENABLE_TRAINING_APIS=ON \
-Donnxruntime_USE_DNNL=OFF \
-Donnxruntime_USE_NNAPI_BUILTIN=OFF \
-Donnxruntime_USE_RKNPU=OFF \
-Donnxruntime_USE_LLVM=OFF \
-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF \
-Donnxruntime_USE_VITISAI=OFF \
-Donnxruntime_USE_TENSORRT=OFF \
-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=ON \
-Donnxruntime_USE_TVM=OFF \
-Donnxruntime_TVM_CUDA_RUNTIME=OFF \
-Donnxruntime_TVM_USE_HASH=OFF \
-Donnxruntime_USE_MIGRAPHX=OFF \
-Donnxruntime_DISABLE_CONTRIB_OPS=OFF \
-Donnxruntime_DISABLE_ML_OPS=OFF \
-Donnxruntime_DISABLE_EXCEPTIONS=OFF \
-Donnxruntime_MINIMAL_BUILD=OFF \
-Donnxruntime_EXTENDED_MINIMAL_BUILD=OFF \
-Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS=OFF \
-Donnxruntime_REDUCED_OPS_BUILD=OFF \
-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS=OFF \
-Donnxruntime_USE_DML=OFF \
-Donnxruntime_USE_WINML=OFF \
-Donnxruntime_BUILD_MS_EXPERIMENTAL_OPS=OFF \
-Donnxruntime_USE_TELEMETRY=OFF \
-Donnxruntime_ENABLE_LTO=OFF \
-Donnxruntime_ENABLE_PYTHON:BOOL=ON \
-Donnxruntime_USE_ACL=OFF \
-Donnxruntime_USE_ACL_1902=OFF \
-Donnxruntime_USE_ACL_1905=OFF \
-Donnxruntime_USE_ACL_1908=OFF \
-Donnxruntime_USE_ACL_2002=OFF \
-Donnxruntime_USE_ACL_2308=OFF \
-Donnxruntime_USE_ARMNN=OFF \
-Donnxruntime_ARMNN_RELU_USE_CPU=ON \
-Donnxruntime_ARMNN_BN_USE_CPU=ON \
-Donnxruntime_USE_JSEP=OFF \
-Donnxruntime_ENABLE_NVTX_PROFILE=OFF \
-Donnxruntime_ENABLE_CPU_FP16_OPS=ON \
-Donnxruntime_USE_NCCL=OFF \
-Donnxruntime_BUILD_BENCHMARKS=OFF \
-Donnxruntime_USE_ROCM=OFF \
-DOnnxruntime_GCOV_COVERAGE=OFF \
-Donnxruntime_USE_MPI=OFF \
-Donnxruntime_ENABLE_MEMORY_PROFILE=OFF \
-Donnxruntime_ENABLE_CUDA_LINE_NUMBER_INFO=OFF \
-Donnxruntime_USE_CUDA_NHWC_OPS=OFF \
-Donnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING=ON \
-Donnxruntime_ENABLE_WEBASSEMBLY_API_EXCEPTION_CATCHING=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_THROWING=ON \
-Donnxruntime_WEBASSEMBLY_RUN_TESTS_IN_BROWSER=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=OFF \
-Donnxruntime_ENABLE_WEBASSEMBLY_PROFILING=OFF \
-Donnxruntime_ENABLE_LAZY_TENSOR=OFF \
-Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS=OFF \
-Donnxruntime_ENABLE_CUDA_PROFILING=OFF \
-Donnxruntime_ENABLE_ROCM_PROFILING=OFF \
-Donnxruntime_USE_XNNPACK=OFF \
-Donnxruntime_USE_WEBNN=OFF \
-Donnxruntime_USE_CANN=OFF \
-Donnxruntime_USE_TRITON_KERNEL=OFF \
-Donnxruntime_DISABLE_FLOAT8_TYPES=OFF \
-Donnxruntime_DISABLE_SPARSE_TENSORS=OFF \
-Donnxruntime_DISABLE_OPTIONAL_TYPE=OFF \
-Donnxruntime_USE_FULL_PROTOBUF:BOOL=OFF 

PS Who close issue?

from onnxruntime.

pengwa avatar pengwa commented on June 29, 2024

Happy to see you find the a good combination @LaurentBerger.

from onnxruntime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.