aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2023-05-10 04:18:14 +0000
committerYuri Victorovich <yuri@FreeBSD.org>2023-05-10 04:21:01 +0000
commit0779caf29956b7e8645584a3c5e1924b85e60eb6 (patch)
tree81fae8b5bb13db8302de646748d731898981a40b
parent85aebbb57bed45347a7c13009a2cf10abff229ec (diff)
math/dgl: New port: Deep Graph Library
-rw-r--r--math/Makefile1
-rw-r--r--math/dgl/Makefile67
-rw-r--r--math/dgl/distinfo33
-rw-r--r--math/dgl/files/patch-CMakeLists.txt11
-rw-r--r--math/dgl/files/patch-python_dgl_backend_____init____.py13
-rw-r--r--math/dgl/files/patch-src_runtime_shared__mem.cc10
-rw-r--r--math/dgl/files/patch-third__party_METIS_libmetis_CMakeLists.txt19
-rw-r--r--math/dgl/files/patch-third__party_tensorpipe_tensorpipe_common_system.cc41
-rw-r--r--math/dgl/pkg-descr2
-rw-r--r--math/dgl/pkg-plist64
10 files changed, 261 insertions, 0 deletions
diff --git a/math/Makefile b/math/Makefile
index 17f1dddbe5de..89cacac3a106 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -268,6 +268,7 @@
SUBDIR += cvc5
SUBDIR += dbcsr
SUBDIR += deal.ii
+ SUBDIR += dgl
SUBDIR += dieharder
SUBDIR += dihydrogen
SUBDIR += dionysus
diff --git a/math/dgl/Makefile b/math/dgl/Makefile
new file mode 100644
index 000000000000..bb8bc1f216b4
--- /dev/null
+++ b/math/dgl/Makefile
@@ -0,0 +1,67 @@
+PORTNAME= dgl
+DISTVERSION= 1.1.0
+CATEGORIES= math # machine-learning
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= Deep Graph Library
+WWW= https://www.dgl.ai/
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${BACKEND_DEPENDS} \
+ bash:shells/bash \
+ gmake:devel/gmake
+
+USES= cmake:testing localbase:ldflags python:build shebangfix
+USE_LDCONFIG= yes
+
+USE_GITHUB= yes
+GH_ACCOUNT= dmlc
+GH_TUPLE= apache:tvm:b2e418c:tvm/third_party/tvm \
+ dmlc:dlpack:e2bdd3b:dlpack/third_party/dlpack \
+ dmlc:dmlc-core:bfad207:dmlc_core/third_party/dmlc-core \
+ greg7mdp:parallel-hashmap:25293ce:phmap/third_party/phmap \
+ herumi:xbyak:757e406:xbyak/third_party/xbyak \
+ imneme:pcg-cpp:428802d:pcg/third_party/pcg \
+ jlblancoc:nanoflann:4c47ca2:nanoflann/third_party/nanoflann \
+ KarypisLab:METIS:1060348:metis/third_party/METIS \
+ KarypisLab:GKlib:62de20c:metis_GKlib/third_party/METIS/GKlib \
+ pytorch:tensorpipe:6042f1a:tensorpipe/third_party/tensorpipe \
+ libuv:libuv:1dff88e:tensorpipe_libuv/third_party/tensorpipe/third_party/libuv \
+ google:libnop:aa95422:tensorpipe_libnop/third_party/tensorpipe/third_party/libnop \
+ hfp:libxsmm:fa68755:libxsmm/third_party/libxsmm \
+ NVIDIA:thrust:6a3078c:thrust/third_party/thrust \
+ google:googletest:f71fb4f:googletest/third_party/googletest
+
+SHEBANG_GLOB= *.sh
+
+MAKE_ENV= PYTHON=${PYTHON_CMD}
+CMAKE_ON= BUILD_SHARED_LIBS
+CMAKE_TESTING_ON= BUILD_CPP_TEST # tests fail to compile, see https://github.com/dmlc/dgl/issues/5664
+
+BINARY_ALIAS= make=${GMAKE} python3=${PYTHON_CMD}
+
+PLIST_FILES= lib/libdgl_metis.so # workaround for https://github.com/dmlc/dgl/issues/5666
+
+OPTIONS_RADIO= BACKEND
+OPTIONS_RADIO_BACKEND= PYTORCH TENSORFLOW MXNET
+OPTIONS_DEFAULT= PYTORCH
+
+PYTORCH_DESC= Use PyTorch backend
+PYTORCH_VARS= BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}pytorch>0:misc/py-pytorch@${PY_FLAVOR}
+PYTORCH_MAKE_ENV= DGLBACKEND=pytorch
+
+TENSORFLOW_DESC= Use TensorFlow backend
+TENSORFLOW_VARS= BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}tensorflow>0:science/py-tensorflow@${PY_FLAVOR}
+TENSORFLOW_MAKE_ENV= DGLBACKEND=tensorflow
+TENSORFLOW_CMAKE_ON= -DBUILD_SPARSE=OFF
+
+MXNET_DESC= Use MXNET backend
+MXNET_VARS= BACKEND_DEPENDS=${PYTHON_PKGNAMEPREFIX}mxnet>0:misc/py-mxnet@${PY_FLAVOR}
+MXNET_MAKE_ENV= DGLBACKEND=mxnet
+
+post-install: # workaround for https://github.com/dmlc/dgl/issues/5666
+ ${INSTALL_LIB} ${BUILD_WRKSRC}/third_party/METIS/libmetis/libdgl_metis.so ${STAGEDIR}${PREFIX}/lib
+
+.include <bsd.port.mk>
diff --git a/math/dgl/distinfo b/math/dgl/distinfo
new file mode 100644
index 000000000000..8ab0e5fdb4df
--- /dev/null
+++ b/math/dgl/distinfo
@@ -0,0 +1,33 @@
+TIMESTAMP = 1683606177
+SHA256 (dmlc-dgl-1.1.0_GH0.tar.gz) = 71c8ba7777ffdca37638bc796524d42c51006fad385967fa140235b60aac0252
+SIZE (dmlc-dgl-1.1.0_GH0.tar.gz) = 5536874
+SHA256 (apache-tvm-b2e418c_GH0.tar.gz) = f351aee38d7ad4bb1025407e26d5ed21704d1daf6cb2c2b7972ec1bef11189b7
+SIZE (apache-tvm-b2e418c_GH0.tar.gz) = 4105160
+SHA256 (dmlc-dlpack-e2bdd3b_GH0.tar.gz) = e88e702277cf4cfa4814afdbb27b07b75041d80b3df60da387cdd7e0ebeb6817
+SIZE (dmlc-dlpack-e2bdd3b_GH0.tar.gz) = 76235
+SHA256 (dmlc-dmlc-core-bfad207_GH0.tar.gz) = cb9d69eef2b73349367da53f01e54f16b0b26e0f3f063360a33c6313da494fd8
+SIZE (dmlc-dmlc-core-bfad207_GH0.tar.gz) = 256022
+SHA256 (greg7mdp-parallel-hashmap-25293ce_GH0.tar.gz) = 79bf3c49d9a685615b6876cb668c678975762e72efc95ff27afeb04d08f3e4bc
+SIZE (greg7mdp-parallel-hashmap-25293ce_GH0.tar.gz) = 1991684
+SHA256 (herumi-xbyak-757e406_GH0.tar.gz) = ce13e1474237d16e4e1f66601e52db18e66f2ba98037ca800c1d9e6068d67cf6
+SIZE (herumi-xbyak-757e406_GH0.tar.gz) = 237424
+SHA256 (imneme-pcg-cpp-428802d_GH0.tar.gz) = 94cfcaace3031f42a246ef3f01b9da04bbd51baf0a749369f085e9e25e46fdbb
+SIZE (imneme-pcg-cpp-428802d_GH0.tar.gz) = 78185
+SHA256 (jlblancoc-nanoflann-4c47ca2_GH0.tar.gz) = 84523ebbca828309da8ef35544d14c810419d6a7ecc7a6e103049bc4f2900a9e
+SIZE (jlblancoc-nanoflann-4c47ca2_GH0.tar.gz) = 685221
+SHA256 (KarypisLab-METIS-1060348_GH0.tar.gz) = 3d0b2741c650c8a01019e294a12e0bc85653d251fd6956486b7fcbc90314ab1d
+SIZE (KarypisLab-METIS-1060348_GH0.tar.gz) = 4839628
+SHA256 (KarypisLab-GKlib-62de20c_GH0.tar.gz) = b10827ec6c2481aded336dd99de1d241f5c59a65e186fdc1e6d4ee57527941aa
+SIZE (KarypisLab-GKlib-62de20c_GH0.tar.gz) = 178104
+SHA256 (pytorch-tensorpipe-6042f1a_GH0.tar.gz) = b1f269a2694d85345c90acd6d22481702e3da8c3c28c0446c5c134026edf02e8
+SIZE (pytorch-tensorpipe-6042f1a_GH0.tar.gz) = 258701
+SHA256 (libuv-libuv-1dff88e_GH0.tar.gz) = 5a1e54bf17161c2e8886f584e88078318ad9c902d9b7b1d9b0f3e682f43bee48
+SIZE (libuv-libuv-1dff88e_GH0.tar.gz) = 1281275
+SHA256 (google-libnop-aa95422_GH0.tar.gz) = a1bc9d94289868a5d40e36964d57c8e06b52cb4cfff6cc21ff259337f707d0e1
+SIZE (google-libnop-aa95422_GH0.tar.gz) = 124119
+SHA256 (hfp-libxsmm-fa68755_GH0.tar.gz) = da3ebc9e628099a3bcfa2a0c6976f0cd7e8d0eba4a85b65428167e812c367986
+SIZE (hfp-libxsmm-fa68755_GH0.tar.gz) = 5259772
+SHA256 (NVIDIA-thrust-6a3078c_GH0.tar.gz) = c4d32d275c29689c2a7bf3b33dff87d533bb0a2f606256de44cc4e3780cc9130
+SIZE (NVIDIA-thrust-6a3078c_GH0.tar.gz) = 999915
+SHA256 (google-googletest-f71fb4f_GH0.tar.gz) = 196e6d0f943c2f741665e64ed500916fe6273d4f398007c95909ffe187704391
+SIZE (google-googletest-f71fb4f_GH0.tar.gz) = 957143
diff --git a/math/dgl/files/patch-CMakeLists.txt b/math/dgl/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..d973f21dd773
--- /dev/null
+++ b/math/dgl/files/patch-CMakeLists.txt
@@ -0,0 +1,11 @@
+--- CMakeLists.txt.orig 2023-05-09 05:00:36 UTC
++++ CMakeLists.txt
+@@ -197,7 +197,7 @@ if(NOT MSVC)
+ include_directories(${GKLIB_PATH})
+ include_directories("third_party/METIS/include/")
+ add_subdirectory("third_party/METIS/libmetis/")
+- list(APPEND DGL_LINKER_LIBS metis)
++ list(APPEND DGL_LINKER_LIBS dgl_metis)
+ endif(NOT MSVC)
+
+ # Compile LIBXSMM
diff --git a/math/dgl/files/patch-python_dgl_backend_____init____.py b/math/dgl/files/patch-python_dgl_backend_____init____.py
new file mode 100644
index 000000000000..1547284444fe
--- /dev/null
+++ b/math/dgl/files/patch-python_dgl_backend_____init____.py
@@ -0,0 +1,13 @@
+--- python/dgl/backend/__init__.py.orig 2023-05-08 05:34:30 UTC
++++ python/dgl/backend/__init__.py
+@@ -115,8 +115,8 @@ def get_preferred_backend():
+ "Assuming PyTorch for now.",
+ file=sys.stderr,
+ )
+- set_default_backend(default_dir, "pytorch")
+- return "pytorch"
++ set_default_backend(default_dir, "tensorflow")
++ return "tensorflow"
+
+
+ load_backend(get_preferred_backend())
diff --git a/math/dgl/files/patch-src_runtime_shared__mem.cc b/math/dgl/files/patch-src_runtime_shared__mem.cc
new file mode 100644
index 000000000000..9bd03e0fe9f6
--- /dev/null
+++ b/math/dgl/files/patch-src_runtime_shared__mem.cc
@@ -0,0 +1,10 @@
+--- src/runtime/shared_mem.cc.orig 2023-04-30 05:51:10 UTC
++++ src/runtime/shared_mem.cc
+@@ -6,6 +6,7 @@
+ #ifndef _WIN32
+ #include <fcntl.h>
+ #include <sys/mman.h>
++#include <sys/stat.h>
+ #include <unistd.h>
+ #endif
+ #include <dgl/runtime/shared_mem.h>
diff --git a/math/dgl/files/patch-third__party_METIS_libmetis_CMakeLists.txt b/math/dgl/files/patch-third__party_METIS_libmetis_CMakeLists.txt
new file mode 100644
index 000000000000..4e15c3b7ef39
--- /dev/null
+++ b/math/dgl/files/patch-third__party_METIS_libmetis_CMakeLists.txt
@@ -0,0 +1,19 @@
+--- third_party/METIS/libmetis/CMakeLists.txt.orig 2023-05-09 05:04:07 UTC
++++ third_party/METIS/libmetis/CMakeLists.txt
+@@ -3,13 +3,13 @@ include_directories(.)
+ # Find sources.
+ file(GLOB metis_sources *.c)
+ # Build libmetis.
+-add_library(metis ${METIS_LIBRARY_TYPE} ${GKlib_sources} ${metis_sources})
++add_library(dgl_metis ${METIS_LIBRARY_TYPE} ${GKlib_sources} ${metis_sources})
+ if(UNIX)
+- target_link_libraries(metis m)
++ target_link_libraries(dgl_metis m)
+ endif()
+
+ if(METIS_INSTALL)
+- install(TARGETS metis
++ install(TARGETS dgl_metis
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION lib
+ ARCHIVE DESTINATION lib)
diff --git a/math/dgl/files/patch-third__party_tensorpipe_tensorpipe_common_system.cc b/math/dgl/files/patch-third__party_tensorpipe_tensorpipe_common_system.cc
new file mode 100644
index 000000000000..3cd8d0aab6b1
--- /dev/null
+++ b/math/dgl/files/patch-third__party_tensorpipe_tensorpipe_common_system.cc
@@ -0,0 +1,41 @@
+--- third_party/tensorpipe/tensorpipe/common/system.cc.orig 2021-08-31 10:11:56 UTC
++++ third_party/tensorpipe/tensorpipe/common/system.cc
+@@ -16,6 +16,13 @@
+ #include <unistd.h>
+ #endif
+
++#ifdef __FreeBSD__
++#include <pthread.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <unistd.h>
++#endif
++
+ #ifdef __APPLE__
+ #include <IOKit/IOKitLib.h>
+ #endif
+@@ -141,8 +148,9 @@ std::string removeBlankSpaces(std::string s) {
+ }
+
+ optional<std::string> getBootID() {
+- static optional<std::string> bootID = getBootIDInternal();
+- return bootID;
++ //static optional<std::string> bootID = getBootIDInternal();
++ //return bootID;
++ throw std::runtime_error("tensorpipe lacks FreeBSD support (getBootIDInternal), see https://github.com/pytorch/tensorpipe/issues/461");
+ }
+
+ #ifdef __APPLE__
+@@ -277,6 +285,12 @@ optional<std::string> getPermittedCapabilitiesID() {
+ std::ostringstream oss;
+ oss << std::hex << bitmask;
+ return oss.str();
++}
++
++#elif defined(__FreeBSD__)
++
++optional<std::string> getLinuxNamespaceId(LinuxNamespace ns) {
++ return std::string();
+ }
+
+ #endif
diff --git a/math/dgl/pkg-descr b/math/dgl/pkg-descr
new file mode 100644
index 000000000000..459fb5664e85
--- /dev/null
+++ b/math/dgl/pkg-descr
@@ -0,0 +1,2 @@
+DGL is a Python package built to ease deep learning on graphs
+on top of existing DL frameworks.
diff --git a/math/dgl/pkg-plist b/math/dgl/pkg-plist
new file mode 100644
index 000000000000..13b1820cb7d4
--- /dev/null
+++ b/math/dgl/pkg-plist
@@ -0,0 +1,64 @@
+include/dmlc/any.h
+include/dmlc/array_view.h
+include/dmlc/base.h
+include/dmlc/blockingconcurrentqueue.h
+include/dmlc/build_config.h
+include/dmlc/build_config_default.h
+include/dmlc/common.h
+include/dmlc/concurrency.h
+include/dmlc/concurrentqueue.h
+include/dmlc/config.h
+include/dmlc/data.h
+include/dmlc/endian.h
+include/dmlc/filesystem.h
+include/dmlc/input_split_shuffle.h
+include/dmlc/io.h
+include/dmlc/json.h
+include/dmlc/logging.h
+include/dmlc/lua.h
+include/dmlc/memory.h
+include/dmlc/memory_io.h
+include/dmlc/omp.h
+include/dmlc/optional.h
+include/dmlc/parameter.h
+include/dmlc/recordio.h
+include/dmlc/registry.h
+include/dmlc/serializer.h
+include/dmlc/strtonum.h
+include/dmlc/thread_group.h
+include/dmlc/thread_local.h
+include/dmlc/threadediter.h
+include/dmlc/timer.h
+include/dmlc/type_traits.h
+include/tensorpipe/channel/basic/factory.h
+include/tensorpipe/channel/context.h
+include/tensorpipe/channel/error.h
+include/tensorpipe/channel/mpt/factory.h
+include/tensorpipe/channel/xth/factory.h
+include/tensorpipe/common/buffer.h
+include/tensorpipe/common/cpu_buffer.h
+include/tensorpipe/common/device.h
+include/tensorpipe/common/error.h
+include/tensorpipe/common/optional.h
+include/tensorpipe/config.h
+include/tensorpipe/core/context.h
+include/tensorpipe/core/error.h
+include/tensorpipe/core/listener.h
+include/tensorpipe/core/message.h
+include/tensorpipe/core/pipe.h
+include/tensorpipe/tensorpipe.h
+include/tensorpipe/transport/context.h
+include/tensorpipe/transport/error.h
+include/tensorpipe/transport/uv/error.h
+include/tensorpipe/transport/uv/factory.h
+include/tensorpipe/transport/uv/utility.h
+lib/cmake/dmlc/DMLCTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/dmlc/DMLCTargets.cmake
+lib/cmake/dmlc/dmlc-config-version.cmake
+lib/cmake/dmlc/dmlc-config.cmake
+lib/libdgl.so
+lib/libdmlc.so
+lib/libtensorpipe.so
+lib/libtensorpipe_uv.a
+share/cmake/Tensorpipe/TensorpipeTargets-%%CMAKE_BUILD_TYPE%%.cmake
+share/cmake/Tensorpipe/TensorpipeTargets.cmake