diff --git a/math/taco/Portfile b/math/taco/Portfile new file mode 100644 index 000000000000..ce0830649a5b --- /dev/null +++ b/math/taco/Portfile @@ -0,0 +1,68 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 + +PortSystem 1.0 +PortGroup cmake 1.1 +PortGroup github 1.0 +PortGroup legacysupport 1.1 + +github.setup tensor-compiler taco 2b8ece4c230a5f0f0a74bc6f48e28edfb6c1c95e +version 2022.08.02 +revision 0 +categories math +license MIT +maintainers {@barracuda156 gmail.com:vital.had} openmaintainer +description Tensor Algebra Compiler (taco): computes sparse tensor expressions on CPUs and GPUs +long_description The Tensor Algebra Compiler (taco) is a C++ library that computes tensor algebra \ + expressions on sparse and dense tensors. It uses novel compiler techniques \ + to get performance competitive with hand-optimized kernels in widely used libraries \ + for both sparse tensor algebra and sparse linear algebra. +homepage https://tensor-compiler.org + +# Fetch from git instead of distfile because it needs submodules +fetch.type git + +if {${os.major} < 14} { + depends_build-append port:git + git.cmd ${prefix}/bin/git +} + +post-fetch { + system -W ${worksrcpath} "git submodule update --init" +} + +# https://github.com/tensor-compiler/taco/issues/541 +patchfiles patch-no-narrowing.diff + +post-patch { + reinplace "s,@ARCHFLAGS@,[get_canonical_archflags cxx]," ${worksrcpath}/CMakeLists.txt + reinplace "s, -shared -fPIC, [get_canonical_archflags cc] -shared -fPIC," ${worksrcpath}/src/codegen/module.cpp +} + +compiler.cxx_standard 2014 +compiler.openmp_version 3.0 + +legacysupport.newest_darwin_requires_legacy 10 +legacysupport.redirect_bins taco taco-tensor_times_vector taco-test + +configure.args-append \ + -DTACO_SHARED_LIBRARY=on \ + -DOPENMP=on \ + -DCOVERAGE=off \ + -DCUDA=off \ + -DPYTHON=off \ + -DCTEST_PARALLEL_LEVEL=2 + +if {[string match *clang* ${configure.compiler}]} { + configure.ldflags-append \ + -L${prefix}/lib/libomp \ + -lomp +} + +pre-test { + system -W ${cmake.build_dir} "install_name_tool -change ${prefix}/lib/libtaco.dylib ${cmake.build_dir}/lib/libtaco.dylib ${cmake.build_dir}/bin/taco-test" +} + +# Tests will fail on PPC: https://github.com/tensor-compiler/taco/issues/541 +test.run yes +test.cmd ctest +test.cmd-prepend DYLD_LIBRARY_PATH=${cmake.build_dir}/lib diff --git a/math/taco/files/patch-no-narrowing.diff b/math/taco/files/patch-no-narrowing.diff new file mode 100644 index 000000000000..6bbe7856c2a8 --- /dev/null +++ b/math/taco/files/patch-no-narrowing.diff @@ -0,0 +1,11 @@ +--- CMakeLists.txt.orig 2022-12-31 10:48:32.000000000 +0700 ++++ CMakeLists.txt 2022-12-31 11:00:28.000000000 +0700 +@@ -83,7 +83,7 @@ + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + + set(OPTIMIZE "-O3" CACHE STRING "Optimization level") +-set(C_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Woverloaded-virtual -pedantic-errors -Wno-deprecated") ++set(C_CXX_FLAGS "@ARCHFLAGS@ -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Woverloaded-virtual -Wno-deprecated -Wno-narrowing -pedantic-errors") + if(OPENMP) + set(C_CXX_FLAGS "-fopenmp ${C_CXX_FLAGS}") + endif(OPENMP)