项目文件夹

文件
Quan (Andy) Gan 9a7235faf2 [Performance] Use allocator from PyTorch if possible (#2328)
* first commit

* some thoughts

* move around

* more commit

* more fixes

* now it uses torch allocator

* fix symbol export error

* fix

* fixes

* test fix

* add script

* building separate library per version

* fix for vs2019

* more fixes

* fix on windows build

* update jenkinsfile

* auto copy built dlls for windows

* lint and installation guide update

* fix

* specify conda environment

* set environment for ci

* fix

* fix

* fix

* fix again

* revert

* fix cmake

* fix

* switch to using python interpreter path

* remove scripts

* debug

* oops sorry

* Update index.rst

* Update index.rst

* copies automatically, no need for this

* do not print message if library not found

* tiny fixes

* debug on nightly

* replace add_compile_definitions to make CMake 3.5 happy

* fix linking to wrong lib for multiple pytorch envs

* changed building strategy

* fix nightly

* fix windows

* fix windows again

* setup bugfix

* address comments

* change README
2020-12-25 13:57:51 +08:00

42 行
859 B
C++

/*!
* Copyright (c) 2020 by Contributors
* \file tensoradapter.h
* \brief Header file for functions exposed by the adapter library.
*
* Functions in this library must be exported with extern "C" so that DGL can locate
* them with dlsym(3) (or GetProcAddress on Windows).
*/
#ifndef TENSORADAPTER_H_
#define TENSORADAPTER_H_
#include <dlpack/dlpack.h>
#include <vector>
#if defined(WIN32) || defined(_WIN32)
#define TA_EXPORTS __declspec(dllexport)
#else
#define TA_EXPORTS
#endif
namespace tensoradapter {
extern "C" {
/*!
* \brief Allocate an empty tensor
*
* \param shape The shape
* \param dtype The data type
* \param ctx The device
* \return The allocated tensor
*/
TA_EXPORTS DLManagedTensor* TAempty(
std::vector<int64_t> shape, DLDataType dtype, DLContext ctx);
}
}; // namespace tensoradapter
#endif // TENSORADAPTER_H_