Permalink
Browse files

Reorganize directory structure.

  • Loading branch information...
a127a127 committed Jan 23, 2018
0 parents commit 57a6ca4bb7372a7a6cbcf1ce64695cb2aab99b8a
Showing with 27,628 additions and 0 deletions.
  1. +1 −0 .gitattributes
  2. +5 −0 .gitignore
  3. 0 BUGS
  4. +3 −0 ChangeLog
  5. 0 LICENSE.TXT
  6. +9 −0 Makefile.am
  7. +22 −0 README.md
  8. +29 −0 autogen.sh
  9. +91 −0 configure.ac
  10. +1 −0 include/.gitignore
  11. +1 −0 include/Makefile.am
  12. +2 −0 include/onnc/.gitignore
  13. +131 −0 include/onnc/ADT/Any.h
  14. +344 −0 include/onnc/ADT/ArrayRef.h
  15. +223 −0 include/onnc/ADT/BinaryTree.h
  16. +76 −0 include/onnc/ADT/Bits/Any.tcc
  17. +151 −0 include/onnc/ADT/Bits/HashBase.h
  18. +303 −0 include/onnc/ADT/Bits/HashBase.tcc
  19. +243 −0 include/onnc/ADT/Bits/HashIterator.tcc
  20. +302 −0 include/onnc/ADT/Bits/HashTable.tcc
  21. +160 −0 include/onnc/ADT/Bits/IList.tcc
  22. +266 −0 include/onnc/ADT/Bits/TreeIterator.h
  23. +51 −0 include/onnc/ADT/Bits/TreeNode.h
  24. +53 −0 include/onnc/ADT/Bits/TreeNodeAllocator.h
  25. +93 −0 include/onnc/ADT/Buffer.h
  26. +70 −0 include/onnc/ADT/Color.h
  27. +93 −0 include/onnc/ADT/ConstBuffer.h
  28. +87 −0 include/onnc/ADT/Digraph.h
  29. +69 −0 include/onnc/ADT/EditDistance.h
  30. +107 −0 include/onnc/ADT/Flags.h
  31. +178 −0 include/onnc/ADT/HashIterator.h
  32. +140 −0 include/onnc/ADT/HashTable.h
  33. +184 −0 include/onnc/ADT/IList.h
  34. +158 −0 include/onnc/ADT/IListIterator.h
  35. +96 −0 include/onnc/ADT/IListNode.h
  36. +26 −0 include/onnc/ADT/If.h
  37. +51 −0 include/onnc/ADT/OwningPtr.h
  38. +245 −0 include/onnc/ADT/Rope.h
  39. +115 −0 include/onnc/ADT/StringHashTable.h
  40. +366 −0 include/onnc/ADT/StringHasher.h
  41. +36 −0 include/onnc/ADT/StringList.h
  42. +20 −0 include/onnc/ADT/StringMap.h
  43. +310 −0 include/onnc/ADT/StringRef.h
  44. +195 −0 include/onnc/ADT/StringSwitch.h
  45. +22 −0 include/onnc/ADT/TriState.h
  46. +104 −0 include/onnc/ADT/TriValue.h
  47. +85 −0 include/onnc/ADT/TypeSwitch.h
  48. +43 −0 include/onnc/ADT/TypeTag.h
  49. +204 −0 include/onnc/ADT/TypeTraits.h
  50. +31 −0 include/onnc/ADT/Uncopyable.h
  51. +214 −0 include/onnc/Config/Config.h.in
  52. +32 −0 include/onnc/Diagnostic/Bits/Engine.tcc
  53. 0 include/onnc/Diagnostic/Bits/header.h
  54. +54 −0 include/onnc/Diagnostic/DiagCommonKinds.inc
  55. +89 −0 include/onnc/Diagnostic/Diagnostic.h
  56. +35 −0 include/onnc/Diagnostic/DiagnosticInfoMap.h
  57. +77 −0 include/onnc/Diagnostic/Engine.h
  58. +63 −0 include/onnc/Diagnostic/EngineFwd.h
  59. +55 −0 include/onnc/Diagnostic/GeneralOptions.h
  60. +83 −0 include/onnc/Diagnostic/Logger.h
  61. +137 −0 include/onnc/Diagnostic/MsgHandler.h
  62. +158 −0 include/onnc/Diagnostic/MsgHandling.h
  63. +46 −0 include/onnc/Diagnostic/OFStreamLog.h
  64. +30 −0 include/onnc/Diagnostic/Policy.h
  65. +60 −0 include/onnc/Diagnostic/StreamLog.h
  66. +108 −0 include/onnc/Diagnostic/SysLog.h
  67. +56 −0 include/onnc/JSON/Array.h
  68. +70 −0 include/onnc/JSON/Notation.h
  69. +108 −0 include/onnc/JSON/Object.h
  70. +64 −0 include/onnc/JSON/Reader.h
  71. +27 −0 include/onnc/JSON/String.h
  72. +142 −0 include/onnc/JSON/Type.h
  73. +169 −0 include/onnc/JSON/Value.h
  74. +35 −0 include/onnc/Makefile.am
  75. +107 −0 include/onnc/Option/Alias.h
  76. +95 −0 include/onnc/Option/Bits/Apply.h
  77. 0 include/onnc/Option/Bits/header.h
  78. +260 −0 include/onnc/Option/CommandLine.h
  79. +165 −0 include/onnc/Option/OptDefs.h
  80. +238 −0 include/onnc/Option/OptParser.h
  81. +122 −0 include/onnc/Option/OptStorage.h
  82. +125 −0 include/onnc/Option/OptValue.h
  83. +44 −0 include/onnc/Option/Option.h
  84. +58 −0 include/onnc/Option/OptionPool.h
  85. +57 −0 include/onnc/Option/OptionPoolReader.h
  86. +29 −0 include/onnc/Support/AsyncPipe.h
  87. +258 −0 include/onnc/Support/Bits/FileBuf.tcc
  88. +104 −0 include/onnc/Support/Bits/IFStream.tcc
  89. +21 −0 include/onnc/Support/Bits/IStrStream.tcc
  90. +60 −0 include/onnc/Support/Bits/IndentOStreamBuf.tcc
  91. +107 −0 include/onnc/Support/Bits/OFStream.tcc
  92. +25 −0 include/onnc/Support/Bits/OStrStream.tcc
  93. +68 −0 include/onnc/Support/Bits/OStream.tcc
  94. +111 −0 include/onnc/Support/Bits/ObjectPool.tcc
  95. +157 −0 include/onnc/Support/Bits/StringBuf.tcc
  96. 0 include/onnc/Support/Bits/header.h
  97. +199 −0 include/onnc/Support/CArgu.h
  98. +68 −0 include/onnc/Support/CArguRef.h
  99. +96 −0 include/onnc/Support/CEnv.h
  100. +46 −0 include/onnc/Support/Compress.h
  101. +43 −0 include/onnc/Support/DataTypes.h.in
  102. +62 −0 include/onnc/Support/DirIterator.h
  103. +87 −0 include/onnc/Support/Directory.h
  104. +152 −0 include/onnc/Support/Duration.h
  105. +1,049 −0 include/onnc/Support/ELF.h
  106. +64 −0 include/onnc/Support/EditMatch.h
  107. +116 −0 include/onnc/Support/Environ.h
  108. +190 −0 include/onnc/Support/ErrorCode.h
  109. +69 −0 include/onnc/Support/Expansion.h
  110. +119 −0 include/onnc/Support/FileBuf.h
  111. +151 −0 include/onnc/Support/FileHandle.h
  112. +65 −0 include/onnc/Support/FileInfo.h
  113. +50 −0 include/onnc/Support/FileLock.h
  114. +97 −0 include/onnc/Support/FileStatus.h
  115. +224 −0 include/onnc/Support/FileSystem.h
  116. +200 −0 include/onnc/Support/GCFactory.h
  117. +55 −0 include/onnc/Support/Glob.h
  118. +36 −0 include/onnc/Support/Host.h
  119. +105 −0 include/onnc/Support/IFStream.h
  120. +65 −0 include/onnc/Support/IOSFwd.h
  121. +28 −0 include/onnc/Support/IOStream.h
  122. +54 −0 include/onnc/Support/IStrStream.h
  123. +39 −0 include/onnc/Support/IStream.h
  124. +71 −0 include/onnc/Support/IndentOStream.h
  125. +64 −0 include/onnc/Support/IndentOStreamBuf.h
  126. +303 −0 include/onnc/Support/LinearAllocator.h
  127. +119 −0 include/onnc/Support/MallocAllocator.h
  128. +119 −0 include/onnc/Support/ManagedStatic.h
  129. +55 −0 include/onnc/Support/MappedFileRegion.h
  130. +120 −0 include/onnc/Support/MemoryAllocator.h
  131. +77 −0 include/onnc/Support/MemoryMap.h
  132. +218 −0 include/onnc/Support/MemoryPool.h
  133. +109 −0 include/onnc/Support/OFStream.h
  134. +60 −0 include/onnc/Support/OStrStream.h
  135. +89 −0 include/onnc/Support/OStream.h
  136. +92 −0 include/onnc/Support/ObjectPool.h
  137. +296 −0 include/onnc/Support/Path.h
  138. +102 −0 include/onnc/Support/Pipe.h
  139. +39 −0 include/onnc/Support/Random.h
  140. +54 −0 include/onnc/Support/Readline.h
  141. +35 −0 include/onnc/Support/SelfPipe.h
  142. +24 −0 include/onnc/Support/SigAction.h
  143. +100 −0 include/onnc/Support/Signal.h
  144. +47 −0 include/onnc/Support/Slab.h
  145. +202 −0 include/onnc/Support/SlabIterator.h
  146. +76 −0 include/onnc/Support/StringBuf.h
  147. +45 −0 include/onnc/Support/Timer.h
  148. +188 −0 include/onnc/Support/UnixPrv.h
  149. 0 include/onnc/Support/header.h
  150. +1 −0 lib/.gitignore
  151. +60 −0 lib/ADT/Any.cpp
  152. +30 −0 lib/ADT/Buffer.cpp
  153. +69 −0 lib/ADT/Color.cpp
  154. +25 −0 lib/ADT/ConstBuffer.cpp
  155. +172 −0 lib/ADT/Digraph.cpp
  156. +128 −0 lib/ADT/IList.cpp
  157. +34 −0 lib/ADT/IListIterator.cpp
  158. +243 −0 lib/ADT/Rope.cpp
  159. +261 −0 lib/ADT/Serializing.cpp
  160. +42 −0 lib/ADT/StringList.cpp
  161. +564 −0 lib/ADT/StringRef.cpp
  162. +59 −0 lib/ADT/TypeTag.cpp
  163. +235 −0 lib/Diagnostic/Diagnostic.cpp
  164. +63 −0 lib/Diagnostic/DiagnosticInfoMap.cpp
  165. +85 −0 lib/Diagnostic/Engine.cpp
  166. +19 −0 lib/Diagnostic/GeneralOptions.cpp
  167. +78 −0 lib/Diagnostic/Logger.cpp
  168. +54 −0 lib/Diagnostic/MsgHandler.cpp
  169. +31 −0 lib/Diagnostic/MsgHandling.cpp
  170. +29 −0 lib/Diagnostic/OFStreamLog.cpp
  171. +27 −0 lib/Diagnostic/Policy.cpp
  172. +98 −0 lib/Diagnostic/StreamLog.cpp
  173. +167 −0 lib/Diagnostic/SysLog.cpp
  174. +44 −0 lib/JSON/Array.cpp
  175. +183 −0 lib/JSON/JsonParser.ypp
  176. +112 −0 lib/JSON/JsonScanner.lpp
  177. +47 −0 lib/JSON/Notation.cpp
  178. +111 −0 lib/JSON/Object.cpp
  179. +59 −0 lib/JSON/String.cpp
  180. +306 −0 lib/JSON/Value.cpp
  181. +45 −0 lib/Makefile.am
  182. +38 −0 lib/Option/Alias.cpp
  183. +311 −0 lib/Option/CommandLine.cpp
  184. +248 −0 lib/Option/OptDefs.cpp
  185. +207 −0 lib/Option/OptParser.cpp
  186. +48 −0 lib/Option/Option.cpp
  187. +128 −0 lib/Option/OptionPool.cpp
  188. +20 −0 lib/Support/AsyncPipe.cpp
  189. +358 −0 lib/Support/CArgu.cpp
  190. +27 −0 lib/Support/CArguRef.cpp
  191. +127 −0 lib/Support/CEnv.cpp
  192. +123 −0 lib/Support/Compress.cpp
  193. +62 −0 lib/Support/DirIterator.cpp
  194. +85 −0 lib/Support/Directory.cpp
  195. +11 −0 lib/Support/Dragon/Directory.inc
  196. +72 −0 lib/Support/Dragon/FileStatus.inc
  197. +126 −0 lib/Support/Dragon/Path.inc
  198. 0 lib/Support/Dragon/header.h
  199. +169 −0 lib/Support/Duration.cpp
  200. +131 −0 lib/Support/Environ.cpp
  201. +31 −0 lib/Support/ErrorCode.cpp
  202. +50 −0 lib/Support/Expansion.cpp
  203. +287 −0 lib/Support/FileHandle.cpp
  204. +40 −0 lib/Support/FileInfo.cpp
  205. +74 −0 lib/Support/FileLock.cpp
  206. +53 −0 lib/Support/FileStatus.cpp
  207. +477 −0 lib/Support/FileSystem.cpp
  208. +39 −0 lib/Support/Glob.cpp
  209. +64 −0 lib/Support/IOStream.cpp
  210. +57 −0 lib/Support/IndentOStreamBuf.cpp
  211. +55 −0 lib/Support/ManagedStatic.cpp
  212. +55 −0 lib/Support/MappedFileRegion.cpp
  213. +37 −0 lib/Support/MemoryMap.cpp
  214. +278 −0 lib/Support/Path.cpp
  215. +20 −0 lib/Support/Pipe.cpp
  216. +20 −0 lib/Support/Random.cpp
  217. +78 −0 lib/Support/Readline.cpp
  218. +20 −0 lib/Support/SelfPipe.cpp
  219. +48 −0 lib/Support/Signal.cpp
  220. +29 −0 lib/Support/Slab.cpp
  221. +23 −0 lib/Support/Timer.cpp
  222. +27 −0 lib/Support/Unix/AsyncPipe.inc
  223. +56 −0 lib/Support/Unix/Directory.inc
  224. +69 −0 lib/Support/Unix/Expansion.inc
  225. +73 −0 lib/Support/Unix/FileHandle.inc
  226. +95 −0 lib/Support/Unix/FileStatus.inc
  227. +336 −0 lib/Support/Unix/FileSystem.inc
  228. +56 −0 lib/Support/Unix/Glob.inc
  229. +13 −0 lib/Support/Unix/Path.inc
  230. +71 −0 lib/Support/Unix/Pipe.inc
  231. +57 −0 lib/Support/Unix/Random.inc
  232. +53 −0 lib/Support/Unix/SelfPipe.inc
  233. +104 −0 lib/Support/Unix/Timer.inc
  234. 0 lib/Support/Unix/header.h
  235. +11 −0 lib/Support/Windows/Directory.inc
  236. +71 −0 lib/Support/Windows/FileStatus.inc
  237. +125 −0 lib/Support/Windows/Path.inc
  238. 0 lib/Support/Windows/header.h
  239. +1,104 −0 lib/Support/linenoise.cpp
  240. +64 −0 lib/Support/linenoise.h
  241. +5 −0 m4/.gitignore
  242. +363 −0 m4/acx_pthread.m4
  243. +142 −0 m4/ax_cxx_compile_stdcxx_11.m4
  244. +532 −0 m4/ax_prog_doxygen.m4
  245. +199 −0 m4/canoncial_system.m4
  246. +27 −0 m4/config.m4
  247. +19 −0 m4/cxx_flag_check.m4
  248. +18 −0 m4/dl.m4
  249. +21 −0 m4/enable_option.m4
  250. +38 −0 m4/libonnc.m4
  251. +33 −0 m4/optimizer.m4
  252. +26 −0 m4/pthread_check.m4
  253. +53 −0 m4/skypat_check.m4
  254. +72 −0 m4/stl_hash.m4
  255. +22 −0 m4/werror-flags.m4
  256. +51 −0 m4/zlib_check.m4
  257. +7 −0 scripts/.gitignore
  258. +1 −0 tools/.gitignore
  259. +3 −0 tools/Makefile.am
  260. +1 −0 tools/unittests/.gitignore
  261. +35 −0 tools/unittests/Makefile.am
  262. +17 −0 tools/unittests/main.cpp
@@ -0,0 +1 @@
*.onnx filter=lfs diff=lfs merge=lfs -text
@@ -0,0 +1,5 @@
Makefile.in
aclocal.m4
config.log
configure
autom4te.cache
0 BUGS
No changes.
@@ -0,0 +1,3 @@
2018-1-17 Luba Tang <luba@skymizer.com>
* Initialization: create all directory structures and auto-tool building
system.
No changes.
@@ -0,0 +1,9 @@
ACLOCAL_AMFLAGS=-I m4

AUTOMAKE_OPTIONS = foreign

SUBDIRS = include lib tools

dist_pkgdata_DATA = README LICENSE.TXT

EXTRA_DIST = ./autogen.sh
@@ -0,0 +1,22 @@
# Introduction
ONNC (Open Neural Network Compiler)

# Test

## Add or Remove a Unit-Test

From CI pipeline:
0. ci/.gitlab-ci.yml
1. docker/common.sh

From docker development environment:
0. docker/in-container/testall

# Directory Structure
* README - This document
* docs - documents
* externals - The 3rd-party projects
* include - header files for libonnc
* lib - implementation for libonnc
* test - Quick regression tests for ONNC.
* tools - tools based on libonnc
@@ -0,0 +1,29 @@
#!/bin/sh
# The ONNC Project
#

call()
{
local PROGRAM=`which $1`
if [ ! -z "${PROGRAM}" ]; then
$*
else
echo "error: $1: command not found"
exit 1
fi
}

LIBTOOLIZE=libtoolize
my_uname=`uname`

if [ ${my_uname} = "Darwin" ]; then
LIBTOOLIZE=glibtoolize
fi
root=`dirname $0`
cd $root

call aclocal -I ./m4
call autoheader
call ${LIBTOOLIZE} --force
call automake --add-missing
call autoconf
@@ -0,0 +1,91 @@
#
# The ONNC Project
#
# See LICENSE.TXT for details.
##############################################################################

# Autoconf/Automake Initialization

dnl AC_INIT(PKG_NAME, BUILD_VERSION, BUG_REPORTER)
AC_INIT([ONNC],[dev],[bugs@onnc.org])
AC_PREREQ(2.59)

AC_CONFIG_SRCDIR([LICENSE.TXT])
AC_CONFIG_AUX_DIR([scripts])
AC_CONFIG_MACRO_DIR([m4])

####################
# Check environments - `host`, `target` and `build`
CHECK_CANONICAL_SYSTEM

AM_INIT_AUTOMAKE([1.9 dist-bzip2 foreign nostdinc subdir-objects])

####################
# Languages
AC_PROG_CC
AC_PROG_CXX
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX_11([noext])
AC_CXX_STL_HASH
AC_PROG_RANLIB
AC_PROG_LEX
AC_PROG_YACC
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
LT_INIT

####################
# Check for compiler warnings
CHECK_WERROR_FLAGS
CXX_FLAG_CHECK([-Wno-variadic-macros])

####################
# Check for libraries
SETUP_CONFIG_HEADER
AC_CONFIG_HEADER(include/onnc/Config/Config.h)
AC_CONFIG_HEADER(include/onnc/Support/DataTypes.h)

####################
# Check for types
AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t])
AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t])
AC_CHECK_TYPES([long double, long long, long long int, unsigned long long int])
AC_CHECK_TYPES([off_t, size_t, ssize_t])
AC_TYPE_LONG_DOUBLE_WIDER

####################
# Check for headers
AC_CHECK_HEADERS([sys/time.h])

####################
# Check for functions
AC_SEARCH_LIBS([clock_gettime], [rt], [
AC_DEFINE(HAVE_CLOCK_GETTIME, 1,[Have clock_gettime])
])
AC_CHECK_FUNCS([gettimeofday])

####################
# Check for options
CHECK_PTHREAD
CHECK_SKYPAT
CHECK_ZLIB
CHECK_ENABLE_OPTION([debug], [no], [ENABLE_DEBUG])
CHECK_ENABLE_OPTION([unittest], [no], [ENABLE_UNITTEST])
CHECK_ENABLE_OPTION([regression], [no], [ENABLE_REGRESSION])
CHECK_ENABLE_OPTION([optimize], [no], [ENABLE_OPTIMIZE])
CHECK_ENABLE_OPTION([clock_gettime], [no], [ENABLE_CLOCK_GETTIME])
CHECK_ENABLE_OPTION([gettimeofday], [yes], [ENABLE_GETTIMEOFDAY])

####################
# Check for variables
CHECK_ONNC

####################
# OUTPUT
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([include/Makefile])
AC_CONFIG_FILES([include/onnc/Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([tools/Makefile])
AC_CONFIG_FILES([tools/unittests/Makefile])

AC_OUTPUT
@@ -0,0 +1 @@
Makefile.in
@@ -0,0 +1 @@
SUBDIRS = onnc
@@ -0,0 +1,2 @@
Makefile.in
.*.swp
@@ -0,0 +1,131 @@
//===- Any.h --------------------------------------------------------------===//
//
// The ONNC Project
//
// See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef ONNC_ADT_ANY_H
#define ONNC_ADT_ANY_H
#include <onnc/Support/OStrStream.h>
#include <onnc/ADT/TypeTraits.h>
#include <onnc/ADT/TypeTag.h>
#include <ostream>

namespace onnc {

/** \class Any
* \brief Any is a storage for multiple types.
*/
class Any
{
public:
Any();

template<typename ValueType> Any(const ValueType& pValue);

Any(const Any& pCopy);

virtual ~Any();

Any& swap(Any& pRHS);

template<typename ValueType> Any& operator=(const ValueType& pRHS);

Any& operator=(const Any& pRHS);

bool empty() const;

void clear();

void print(std::ostream& pOS) const;

virtual Any* clone() const;

TypeTag type() const {
return (NULL == m_pContent)? NULL : m_pContent->type();
}

protected:
template<typename ValueType>
friend ValueType* unsafe_cast(Any*);

struct PlaceHolder
{
public:
virtual ~PlaceHolder() { }
virtual PlaceHolder* clone() const = 0;
virtual void print(std::ostream& pOS) const = 0;
virtual TypeTag type() const = 0;
virtual bool classof(const PlaceHolder& pHolder) const = 0;
};

template<typename ValueType>
struct Holder : public PlaceHolder
{
public:
Holder(const ValueType& pValue) : held(pValue) { }

Holder* clone() const { return new Holder(held); }

void print(std::ostream& pOS) const { pOS << held; }

TypeTag type() const { return type_tag<ValueType>(); }

bool classof(const PlaceHolder& pHolder) const {
return (pHolder.type() == this->type());
}

private:
Holder& operator=(const Holder& ); // NOT IMPLEMENT

public:
ValueType held;
};

protected:
PlaceHolder* m_pContent;
};

//===----------------------------------------------------------------------===//
// Series of casting
//===----------------------------------------------------------------------===//
template<typename ValueType> ValueType*
unsafe_cast(Any* pOperand);

template<typename ValueType> const ValueType*
unsafe_cast(const Any* pOperand);

template<typename ValueType> ValueType
unsafe_cast(Any& pOperand);

template<typename ValueType> ValueType
unsafe_cast(const Any& pOperand);

template<typename ValueType> ValueType&&
unsafe_cast(Any&& pOperand);

} // namespace of onnc

namespace std {

inline ostream&
operator<<(ostream& pOS, const onnc::Any& pValue)
{
pValue.print(pOS);
return pOS;
}

inline std::string to_string(const onnc::Any& pAny)
{
std::string result;
onnc::OStrStream oss(result);
pAny.print(oss);
return result;
}

} // namespace of std

#include "Bits/Any.tcc"

#endif
Oops, something went wrong.

0 comments on commit 57a6ca4

Please sign in to comment.