You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I tried to write programs using both libmesh and libtorch, but I couldn't write the makefile, and libtorch uses cmake, which confused me even more. Has anyone done the same job and wants to see how you write makefiles.
I noticed MOOSE had similar work, I tried copying MOOSE's makefile, libtorch didn't work.
# Conditional parts if the user wants to compile MOOSE with torchlib
#
ifeq ($(ENABLE_LIBTORCH),true)
LIBTORCH_LIB := libtorch.$(lib_suffix)
ifneq ($(wildcard $(LIBTORCH_DIR)/lib/$(LIBTORCH_LIB)),)
# Enabling parts that have pytorch dependencies
libmesh_CXXFLAGS += -DLIBTORCH_ENABLED
# Adding the include directories, we use -isystem to silence the warning coming from
# libtorch (which would cause errors in the testing phase)
libmesh_CXXFLAGS += -isystem $(LIBTORCH_DIR)/include/torch/csrc/api/include
libmesh_CXXFLAGS += -isystem $(LIBTORCH_DIR)/include
# Dynamically linking with the available pytorch library
libmesh_LDFLAGS += -Wl,-rpath,$(LIBTORCH_DIR)/lib
libmesh_LDFLAGS += -L$(LIBTORCH_DIR)/lib -ltorch
else
$(error ERROR! Cannot locate any dynamic libraries of libtorch. Make sure to install libtorch (manually or using scripts/setup_libtorch.sh) and to run the configure --with-libtorch before compiling moose!)
endif
endif
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Recently I tried to write programs using both libmesh and libtorch, but I couldn't write the makefile, and libtorch uses cmake, which confused me even more. Has anyone done the same job and wants to see how you write makefiles.
I noticed MOOSE had similar work, I tried copying MOOSE's makefile, libtorch didn't work.
Beta Was this translation helpful? Give feedback.
All reactions