@@ -27,87 +27,87 @@ include(ExternalProject)
2727# ------------------------------------------------------------------------------
2828
2929# Where to place PyTorch after installation
30- set (PYTORCH_INSTALL_DIR "${PROJECT_BINARY_DIR} /pytorch-install" )
31- set (PYTORCH_BUILD_DIR "${PROJECT_BINARY_DIR} /pytorch-prefix/src/pytorch-build" )
30+ # set(PYTORCH_INSTALL_DIR "${PROJECT_BINARY_DIR}/pytorch-install")
31+ # set(PYTORCH_BUILD_DIR "${PROJECT_BINARY_DIR}/pytorch-prefix/src/pytorch-build")
3232
33- set (PYTORCH_INSTALL_PREFIX "${PROJECT_BINARY_DIR} /pytorch-install-prefix" )
33+ # set(PYTORCH_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/pytorch-install-prefix")
3434# file(MAKE_DIRECTORY "${PYTORCH_INSTALL_PREFIX}")
3535
3636# ExternalProject_Add can fetch from Git, a local path, or a release tarball.
3737# Here, for simplicity, we'll fetch from Git. In practice, you might want
3838# a fixed commit or a release tarball for reproducible builds.
3939
40- ExternalProject_Add (
41- pytorch
42- GIT_REPOSITORY https://github.com/pytorch/pytorch.git
43- GIT_TAG v2.6.0 # Example: specify a particular release
44- UPDATE_COMMAND "" # Don’t auto-run 'git pull'
45- PATCH_COMMAND "" # No custom patch step
40+ # ExternalProject_Add(
41+ # pytorch
42+ # GIT_REPOSITORY https://github.com/pytorch/pytorch.git
43+ # GIT_TAG v2.6.0 # Example: specify a particular release
44+ # UPDATE_COMMAND "" # Don’t auto-run 'git pull'
45+ # PATCH_COMMAND "" # No custom patch step
4646
47- # DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/pytorch-download" # Where to download the repo
48-
49- # We need all PyTorch submodules. By default, ExternalProject won't do submodule init.
50- # So we can do that in a separate step if we want a full build. For a minimal CPU build,
51- # you might not need them all, but let's be safe:
52- STEP_TARGETS clone
53- # After 'clone', run "git submodule update --init --recursive"
54- # to fetch all submodules.
55- # We can use a little trick with COMMAND.
56- # PATCH_COMMAND "git submodule update --init --recursive"
57-
58- # CMAKE_ARGS
59- # -DBUILD_SHARED_LIBS=OFF # Build static libraries
60- # -DBUILD_PYTHON=OFF # Don’t build Python bindings
61- # -DBUILD_TEST=OFF # Don’t build tests
62- # -DUSE_CUDA=OFF # Disable CUDA
63- # -DUSE_CUDNN=OFF # Disable cuDNN
64- # -DUSE_MKLDNN=OFF # Disable MKLDNN for simplicity
65- # # -DBUILD_BINARY=ON
66- # # -DUSE_DISTRIBUTED=ON
67- # # -DBUILD_STATIC_RUNTIME_BENCHMARK=ON
68- # # -DBUILD_LITE_INTERPRETER=ON
69- # # -DUSE_STATIC_MKL=ON
70- # # -DSTATIC_DISPATCH_BACKEND=ON
71- # # -DCAFFE2_USE_MSVC_STATIC_RUNTIME=ON
72- # # -DUSE_DISTRIBUTED=ON
73- # # -DCMAKE_BUILD_TYPE=Release
74- # -DCMAKE_INSTALL_PREFIX=${PYTORCH_INSTALL_DIR}
75- # # -DCMAKE_POLICY_VERSION_MINIMUM=3.5
76- CMAKE_ARGS
77- -DBUILD_SHARED_LIBS=OFF # Build static libraries
78- -DBUILD_PYTHON=OFF # Don’t build Python bindings
79- -DBUILD_TEST=OFF # Don’t build tests
80- -DUSE_CUDA=OFF # Disable CUDA
81- -DUSE_CUDNN=OFF # Disable cuDNN
82- -DUSE_MKLDNN=OFF # Disable MKLDNN for simplicity
83- -DCMAKE_BUILD_TYPE=Release
84- -DCMAKE_INSTALL_PREFIX=${PYTORCH_INSTALL_DIR}
47+ # # DOWNLOAD_DIR "${CMAKE_BINARY_DIR}/pytorch-download" # Where to download the repo
48+
49+ # # We need all PyTorch submodules. By default, ExternalProject won't do submodule init.
50+ # # So we can do that in a separate step if we want a full build. For a minimal CPU build,
51+ # # you might not need them all, but let's be safe:
52+ # STEP_TARGETS clone
53+ # # After 'clone', run "git submodule update --init --recursive"
54+ # # to fetch all submodules.
55+ # # We can use a little trick with COMMAND.
56+ # # PATCH_COMMAND "git submodule update --init --recursive"
57+
58+ # # CMAKE_ARGS
59+ # # -DBUILD_SHARED_LIBS=OFF # Build static libraries
60+ # # -DBUILD_PYTHON=OFF # Don’t build Python bindings
61+ # # -DBUILD_TEST=OFF # Don’t build tests
62+ # # -DUSE_CUDA=OFF # Disable CUDA
63+ # # -DUSE_CUDNN=OFF # Disable cuDNN
64+ # # -DUSE_MKLDNN=OFF # Disable MKLDNN for simplicity
65+ # # # -DBUILD_BINARY=ON
66+ # # # -DUSE_DISTRIBUTED=ON
67+ # # # -DBUILD_STATIC_RUNTIME_BENCHMARK=ON
68+ # # # -DBUILD_LITE_INTERPRETER=ON
69+ # # # -DUSE_STATIC_MKL=ON
70+ # # # -DSTATIC_DISPATCH_BACKEND=ON
71+ # # # -DCAFFE2_USE_MSVC_STATIC_RUNTIME=ON
72+ # # # -DUSE_DISTRIBUTED=ON
73+ # # # -DCMAKE_BUILD_TYPE=Release
74+ # # -DCMAKE_INSTALL_PREFIX=${PYTORCH_INSTALL_DIR}
75+ # # # -DCMAKE_POLICY_VERSION_MINIMUM=3.5
76+ # CMAKE_ARGS
77+ # -DBUILD_SHARED_LIBS=OFF # Build static libraries
78+ # -DBUILD_PYTHON=OFF # Don’t build Python bindings
79+ # -DBUILD_TEST=OFF # Don’t build tests
80+ # -DUSE_CUDA=OFF # Disable CUDA
81+ # -DUSE_CUDNN=OFF # Disable cuDNN
82+ # -DUSE_MKLDNN=OFF # Disable MKLDNN for simplicity
83+ # -DCMAKE_BUILD_TYPE=Release
84+ # -DCMAKE_INSTALL_PREFIX=${PYTORCH_INSTALL_DIR}
8585
86- INSTALL_DIR ${PYTORCH_INSTALL_DIR} # Where to install
87-
88- # LOG_DOWNLOAD ON
89- # LOG_UPDATE ON
90- # LOG_PATCH ON
91- # LOG_CONFIGURE ON
92- # LOG_BUILD ON
93- # LOG_INSTALL ON
86+ # INSTALL_DIR ${PYTORCH_INSTALL_DIR} # Where to install
87+
88+ # # LOG_DOWNLOAD ON
89+ # # LOG_UPDATE ON
90+ # # LOG_PATCH ON
91+ # # LOG_CONFIGURE ON
92+ # # LOG_BUILD ON
93+ # # LOG_INSTALL ON
9494
95- )
96-
95+ # )
9796
98- file (GLOB_RECURSE PYTORCH_INCLUDES "${PYTORCH_INSTALL_DIR} /include" "*.h" )
99- file (GLOB_RECURSE PYTORCH_LIBS "${PYTORCH_INSTALL_DIR} /lib" "*.a" )
97+ set (PYTORCH_INSTALL_DIR "${PROJECT_ROOT_DIR} /libtorch" )
98+ # file(GLOB_RECURSE PYTORCH_INCLUDES "${PYTORCH_INSTALL_DIR}/include" "*.h")
99+ # file(GLOB_RECURSE PYTORCH_LIBS "${PYTORCH_INSTALL_DIR}/lib" "*.a")
100100
101101
102- set (PYTORCH_LIBS_LINKER_ARGS "" ) # Will hold the list of "-l..." flags.
103- foreach (lib_path IN LISTS PYTORCH_LIBS)
104- # Get just the filename without the directory or extension
105- get_filename_component (lib_name "${lib_path} " NAME_WE )
106- # If it starts with "lib", strip that off
107- string (REGEX REPLACE "^lib" "" lib_name "${lib_name} " )
108- # Now prepend "-l" to the actual library name
109- list (APPEND MY_LIBS "-l${lib_name} " )
110- endforeach ()
102+ # set(PYTORCH_LIBS_LINKER_ARGS "-L/Users/jade/Development/libtorch/libtorch/lib ") # Will hold the list of "-l..." flags.
103+ # foreach(lib_path IN LISTS PYTORCH_LIBS)
104+ # # Get just the filename without the directory or extension
105+ # get_filename_component(lib_name "${lib_path}" NAME_WE)
106+ # # If it starts with "lib", strip that off
107+ # string(REGEX REPLACE "^lib" "" lib_name "${lib_name}")
108+ # # Now prepend "-l" to the actual library name
109+ # list(APPEND MY_LIBS "-l${lib_name}")
110+ # endforeach()
111111
112112
113113find_package (chpl REQUIRED HINTS ${PROJECT_ROOT_DIR} /cmake/chapel )
@@ -123,60 +123,61 @@ project(MyProject LANGUAGES CXX C CHPL)
123123# We'll create a dummy target that depends on 'pytorch' so that
124124# building your own code will first build/install PyTorch.
125125
126- add_library (torch_interface INTERFACE )
126+ # add_library(torch_interface INTERFACE)
127127
128- # Ensure that our 'torch_interface' target isn't used until PyTorch is built
129- add_dependencies (torch_interface pytorch )
128+ # # Ensure that our 'torch_interface' target isn't used until PyTorch is built
129+ # # add_dependencies(torch_interface pytorch)
130130
131- # Include directories for PyTorch
132- target_include_directories (torch_interface INTERFACE
133- "${PYTORCH_INSTALL_DIR} /include"
134- "${PYTORCH_INSTALL_DIR} /include/torch/csrc/api/include"
135- # "${PYTORCH_BUILD_DIR}/aten/src/include"
136- )
131+ # # Include directories for PyTorch
132+ # target_include_directories(torch_interface INTERFACE
133+ # "${PYTORCH_INSTALL_DIR}/include"
134+ # "${PYTORCH_INSTALL_DIR}/include/torch/csrc/api/include"
135+ # # "${PYTORCH_BUILD_DIR}/aten/src/include"
136+ # )
137137
138- # Link the relevant static libraries. For a minimal CPU-only build,
139- # you'll likely need at least these (names can vary by version).
140- # The exact set can differ depending on which components got built.
138+ # # Link the relevant static libraries. For a minimal CPU-only build,
139+ # # you'll likely need at least these (names can vary by version).
140+ # # The exact set can differ depending on which components got built.
141141
142- target_link_libraries (torch_interface INTERFACE
143- "${PYTORCH_INSTALL_DIR} /lib/libtorch.a"
144- "${PYTORCH_INSTALL_DIR} /lib/libtorch_cpu.a"
145- "${PYTORCH_INSTALL_DIR} /lib/libc10.a"
142+ # target_link_libraries(torch_interface INTERFACE
143+ # "${PYTORCH_INSTALL_DIR}/lib/libtorch.a"
144+ # "${PYTORCH_INSTALL_DIR}/lib/libtorch_cpu.a"
145+ # "${PYTORCH_INSTALL_DIR}/lib/libc10.a"
146146
147- ${PYTORCH_LIBS}
147+ # # ${PYTORCH_LIBS}
148148
149- # System libraries often needed:
150- pthread
151- dl
152- rt
153- )
149+ # # System libraries often needed:
150+ # pthread
151+ # dl
152+ # rt
153+ # )
154154
155155
156156
157157add_executable (CHPLTest lib/CHPLTest.chpl )
158158
159159
160- add_library (torchbridge STATIC "${PROJECT_ROOT_DIR} /lib/bridge.cpp" "${PROJECT_ROOT_DIR} /include/bridge.h" )
161- add_dependencies (torchbridge torch_interface )
160+ add_library (torchbridge OBJECT "${PROJECT_ROOT_DIR} /lib/bridge.cpp" "${PROJECT_ROOT_DIR} /include/bridge.h" )
161+ # add_dependencies(torchbridge torch_interface)
162162
163163target_include_directories (torchbridge PRIVATE
164164 "${PYTORCH_INSTALL_DIR} /include"
165165 "${PYTORCH_INSTALL_DIR} /include/torch/csrc/api/include"
166166 "${PROJECT_ROOT_DIR} /include"
167- # "${PYTORCH_BUILD_DIR}/aten/src/include"
167+ # # "${PYTORCH_BUILD_DIR}/aten/src/include"
168168)
169169# target_link_directories(torchbridge PUBLIC
170170# "${PYTORCH_INSTALL_DIR}/lib"
171171# )
172- target_link_libraries (torchbridge
173- PRIVATE
174- torch_interface
175- ${PYTORCH_LIBS}
176- pthread
177- dl
178- rt
179- )
172+ # target_link_libraries(torchbridge
173+ # PRIVATE
174+ # # torch_interface
175+ # # ${PYTORCH_LIBS}
176+
177+ # pthread
178+ # dl
179+ # rt
180+ # )
180181
181182
182183
@@ -190,17 +191,17 @@ target_link_options(Bridge
190191 PRIVATE
191192 "${PROJECT_ROOT_DIR} /include/bridge.h"
192193 "-L${PROJECT_BINARY_DIR} "
193- "-ltorchbridge"
194- -L.
194+ # "-ltorchbridge"
195+ # -L.
195196 "-ltorchbridge"
196197 # "-I${PROJECT_BINARY_DIR}"
197- # "-L${PYTORCH_INSTALL_DIR}/lib"
198+ "-L${PYTORCH_INSTALL_DIR} /lib"
198199 # "-I${PYTORCH_INSTALL_DIR}/include"
199200 # "-I${PYTORCH_INSTALL_DIR}/include/torch/csrc/api/include"
200- # "-ltorch"
201- # "-ltorch_cpu"
201+ "-ltorch"
202+ "-ltorch_cpu"
202203 # "-lcpuinfo"
203- # "-lc10"
204+ "-lc10"
204205 # "-lsleef"
205206 # "-lclog"
206207 # "-lprotoc"
0 commit comments