Models: added basic database structure

This commit is contained in:
Philippe Tillet
2015-08-05 17:01:42 -07:00
parent ebab87af61
commit df9f6142ef
12 changed files with 639 additions and 199 deletions

View File

@@ -26,6 +26,9 @@ endif()
#Binary to convert .cu files to const char * #Binary to convert .cu files to const char *
add_executable(bin2cpp ${CMAKE_MODULE_PATH}/helpers/bin2cpp.cpp) add_executable(bin2cpp ${CMAKE_MODULE_PATH}/helpers/bin2cpp.cpp)
include("${CMAKE_MODULE_PATH}/helpers/CodeToH.cmake")
#Source files
file(GLOB_RECURSE LIBISAAC_SRC lib/*.cpp) file(GLOB_RECURSE LIBISAAC_SRC lib/*.cpp)
#Python wrapper #Python wrapper

View File

@@ -51,7 +51,7 @@ function(CODE_TO_H)
DEPENDS ${_input_file} ${BIN2CPP_PROGRAM} DEPENDS ${_input_file} ${BIN2CPP_PROGRAM}
COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_path}" COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_path}"
COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\<${_path}/${_name_we}.hpp\\>" >>"${_output_file}" COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\<${_path}/${_name_we}.hpp\\>" >>"${_output_file}"
COMMAND ${BIN2CPP_PROGRAM} --file ${_name} --namespace ${_namespace} --output ${_output_file} --name ${var_name} --eof ${ARGS_EOF} COMMAND ${BIN2CPP_PROGRAM} --file ${_name} --namespace ${_namespace} --output ${_output_file} --name ${var_name} --eof ${ARGS_EOF} --extension ${ARGS_EXTENSION}
WORKING_DIRECTORY "${_path}" WORKING_DIRECTORY "${_path}"
COMMENT "Compiling ${_input_file} to C++ source" COMMENT "Compiling ${_input_file} to C++ source"
) )

View File

@@ -11,6 +11,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <memory> #include <memory>
#include <algorithm>
using namespace std; using namespace std;
typedef map<string, string> opt_t; typedef map<string, string> opt_t;
@@ -70,6 +71,7 @@ parse_options(const vector<string>& args) {
options["--type"] = ""; options["--type"] = "";
options["--file"] = ""; options["--file"] = "";
options["--output"] = ""; options["--output"] = "";
options["--extension"] = "";
options["--namespace"] = ""; options["--namespace"] = "";
options["--eof"] = ""; options["--eof"] = "";
@@ -132,9 +134,11 @@ int main(int argc, const char * const * const argv)
cout.rdbuf(outfile->rdbuf()); cout.rdbuf(outfile->rdbuf());
} }
cout << "#pragma once\n"; if(options["--extension"] != "cpp")
cout << "#pragma once\n";
cout << "\n";
cout << "#include <cstddef>\n"; // defines size_t cout << "#include <cstddef>\n"; // defines size_t
cout << "\n";
int ns_cnt = 0; int ns_cnt = 0;
int level = 0; int level = 0;
if(options["--namespace"] != "") { if(options["--namespace"] != "") {
@@ -143,7 +147,8 @@ int main(int argc, const char * const * const argv)
namespaces >> name; namespaces >> name;
do { do {
add_tabs(level++); add_tabs(level++);
cout << "namespace " << name << " { \n"; cout << "namespace " << name << "\n";
cout << "{\n";
ns_cnt++; ns_cnt++;
namespaces >> name; namespaces >> name;
} while(!namespaces.fail()); } while(!namespaces.fail());
@@ -153,6 +158,7 @@ int main(int argc, const char * const * const argv)
options["--type"] = "char"; options["--type"] = "char";
} }
add_tabs(level); add_tabs(level);
cout << "\n";
cout << "static const " << options["--type"] << " " << options["--name"] << "[] = {\n"; cout << "static const " << options["--type"] << " " << options["--name"] << "[] = {\n";
@@ -176,7 +182,9 @@ int main(int argc, const char * const * const argv)
cout << "};\n"; cout << "};\n";
add_tabs(--level); add_tabs(--level);
cout << "static const size_t " << options["--name"] << "_len" << " = " << std::dec << char_cnt << ";\n"; cout << "\n";
cout << "static const std::size_t " << options["--name"] << "_len" << " = " << std::dec << char_cnt << ";\n";
cout << "\n";
while(ns_cnt--) { while(ns_cnt--) {
add_tabs(--level); add_tabs(--level);

View File

@@ -20,7 +20,7 @@ private:
friend class CommandQueue; friend class CommandQueue;
public: public:
enum ISAACAPI VENDOR enum class ISAACAPI VENDOR
{ {
AMD, AMD,
INTEL, INTEL,
@@ -28,6 +28,13 @@ public:
UNKNOWN UNKNOWN
}; };
enum class ISAACAPI ARCHITECTURE
{
HASWELL,
BROADWELL,
UNKNOWN
};
private: private:
#ifdef ISAAC_WITH_CUDA #ifdef ISAAC_WITH_CUDA
template<CUdevice_attribute attr> template<CUdevice_attribute attr>
@@ -42,13 +49,15 @@ public:
bool operator==(Device const &) const; bool operator==(Device const &) const;
bool operator<(Device const &) const; bool operator<(Device const &) const;
VENDOR vendor() const;
ARCHITECTURE architecture() const;
backend_type backend() const; backend_type backend() const;
size_t clock_rate() const; size_t clock_rate() const;
unsigned int address_bits() const; unsigned int address_bits() const;
driver::Platform platform() const; driver::Platform platform() const;
std::string name() const; std::string name() const;
std::string vendor_str() const; std::string vendor_str() const;
VENDOR vendor() const;
std::vector<size_t> max_work_item_sizes() const; std::vector<size_t> max_work_item_sizes() const;
device_type type() const; device_type type() const;
std::string extensions() const; std::string extensions() const;

View File

@@ -50,6 +50,7 @@ namespace isaac
static void set(driver::CommandQueue const & queue, expression_type operation, numeric_type dtype, std::shared_ptr<model> const & model); static void set(driver::CommandQueue const & queue, expression_type operation, numeric_type dtype, std::shared_ptr<model> const & model);
private: private:
static std::map<driver::CommandQueue, map_type> data_; static std::map<driver::CommandQueue, map_type> data_;
static const std::map<std::pair<driver::Device::VENDOR, driver::Device::ARCHITECTURE> , const char *> database_;
}; };
extern std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<templates::base> > fallbacks; extern std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<templates::base> > fallbacks;

View File

@@ -1,3 +1,10 @@
#Database
set(DATABASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/model/database/")
file(GLOB_RECURSE JSON_FILES "${DATABASE_PATH}/json/*.json")
CODE_TO_H(SOURCES ${JSON_FILES} VARNAME json_files EXTENSION "hpp" OUTPUT_DIR "${DATABASE_PATH}"
NAMESPACE "isaac database" TARGET database EOF "0")
#Compilation
if(ANDROID) if(ANDROID)
add_library(isaac STATIC ${LIBISAAC_SRC}) add_library(isaac STATIC ${LIBISAAC_SRC})
else() else()
@@ -8,6 +15,7 @@ else()
endif() endif()
endif() endif()
#Linkage
if(OPENCL_FOUND) if(OPENCL_FOUND)
target_link_libraries(isaac ${OPENCL_LIBRARIES}) target_link_libraries(isaac ${OPENCL_LIBRARIES})
endif() endif()
@@ -17,13 +25,11 @@ if(CUDA_FOUND)
#Cuda JIT headers to file #Cuda JIT headers to file
set(CUDA_HELPERS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/driver/helpers/cuda/) set(CUDA_HELPERS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/driver/helpers/cuda/)
file(GLOB_RECURSE CUDA_HELPERS_SRC ${CUDA_HELPERS_PATH}/*.cu) file(GLOB_RECURSE CUDA_HELPERS_SRC ${CUDA_HELPERS_PATH}/*.cu)
include("${CMAKE_MODULE_PATH}/helpers/CodeToH.cmake")
CODE_TO_H(SOURCES ${CUDA_HELPERS_SRC} VARNAME kernel_files EXTENSION "hpp" CODE_TO_H(SOURCES ${CUDA_HELPERS_SRC} VARNAME kernel_files EXTENSION "hpp"
OUTPUT_DIR ${CUDA_HELPERS_PATH} NAMESPACE "isaac helpers cuda" TARGET cuda_headers EOF "0") OUTPUT_DIR ${CUDA_HELPERS_PATH} NAMESPACE "isaac helpers cuda" TARGET cuda_headers EOF "0")
endif() endif()
#Installation
install(TARGETS isaac LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install(TARGETS isaac LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
set(INSTALL_INCLUDE_DIR /usr/local/include) set(INSTALL_INCLUDE_DIR /usr/local/include)
install(DIRECTORY isaac "${PROJECT_SOURCE_DIR}/include/isaac" install(DIRECTORY isaac "${PROJECT_SOURCE_DIR}/include/isaac"

View File

@@ -39,6 +39,36 @@ bool Device::operator<(Device const & other) const
} }
Device::VENDOR Device::vendor() const
{
std::string vname = vendor_str();
std::transform(vname.begin(), vname.end(), vname.begin(), ::tolower);
if(vname.find("nvidia")!=std::string::npos)
return VENDOR::NVIDIA;
else if(vname.find("intel")!=std::string::npos)
return VENDOR::INTEL;
else if(vname.find("amd")!=std::string::npos || vname.find("advanced micro devices")!=std::string::npos)
return VENDOR::AMD;
else
return VENDOR::UNKNOWN;
}
Device::ARCHITECTURE Device::architecture() const
{
switch(vendor())
{
case VENDOR::INTEL:
{
return ARCHITECTURE::BROADWELL;
}
default:
{
return ARCHITECTURE::UNKNOWN;
}
}
}
backend_type Device::backend() const backend_type Device::backend() const
{ return backend_; } { return backend_; }
@@ -95,19 +125,6 @@ std::string Device::vendor_str() const
} }
} }
Device::VENDOR Device::vendor() const
{
std::string vname = vendor_str();
std::transform(vname.begin(), vname.end(), vname.begin(), ::tolower);
if(vname.find("nvidia")!=std::string::npos)
return NVIDIA;
else if(vname.find("intel")!=std::string::npos)
return INTEL;
else if(vname.find("amd")!=std::string::npos || vname.find("advanced micro devices")!=std::string::npos)
return AMD;
else
return UNKNOWN;
}
std::vector<size_t> Device::max_work_item_sizes() const std::vector<size_t> Device::max_work_item_sizes() const
{ {

View File

@@ -43,16 +43,16 @@ gemm_parameters::gemm_parameters(unsigned int simd_width
return N*size_of(numeric_t); return N*size_of(numeric_t);
} }
int gemm::is_invalid_impl(driver::Device const &, expressions_tuple const & expressions) const int gemm::is_invalid_impl(driver::Device const &, expressions_tuple const & ) const
{ {
std::vector<int_t> MNK = input_sizes(expressions); // std::vector<int_t> MNK = input_sizes(expressions);
int_t M = MNK[0]; int_t N = MNK[1]; // int_t M = MNK[0]; int_t N = MNK[1];
if(p_.A_fetching_policy!=FETCH_FROM_LOCAL || p_.B_fetching_policy!=FETCH_FROM_LOCAL) if(p_.A_fetching_policy!=FETCH_FROM_LOCAL || p_.B_fetching_policy!=FETCH_FROM_LOCAL)
throw operation_not_supported_exception("Only local memory is supported for GEMM"); throw operation_not_supported_exception("Only local memory is supported for GEMM");
if(p_.depth > 1 && M*N*p_.depth > 2e6) // if(p_.depth > 1 && M*N*p_.depth > 2e6)
throw operation_not_supported_exception("This would necessitate a temporary larger than 1MB"); // throw operation_not_supported_exception("This would necessitate a temporary larger than 1MB");
if ((p_.mS % p_.simd_width) > 0 || (p_.nS % p_.simd_width) > 0) if ((p_.mS % p_.simd_width) > 0 || (p_.nS % p_.simd_width) > 0)
return TEMPLATE_MS_NS_MUST_BE_SIMD_WIDTH_MULTIPLE; return TEMPLATE_MS_NS_MUST_BE_SIMD_WIDTH_MULTIPLE;

View File

@@ -0,0 +1,390 @@
#pragma once
#include <cstddef>
namespace isaac
{
namespace database
{
static const char broadwell[] = {
0x7b, 0x22, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x6e, 0x74, 0x22,
0x3a, 0x20, 0x7b, 0x22, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33,
0x32, 0x22, 0x3a, 0x20, 0x7b, 0x22, 0x70, 0x72, 0x65, 0x64,
0x69, 0x63, 0x74, 0x6f, 0x72, 0x22, 0x3a, 0x20, 0x5b, 0x7b,
0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f,
0x72, 0x69, 0x67, 0x68, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x32,
0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c,
0x20, 0x22, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c,
0x64, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x38, 0x38, 0x2e, 0x30,
0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x63,
0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x6c, 0x65,
0x66, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x2d,
0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22, 0x66,
0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3a, 0x20, 0x5b,
0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30,
0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c,
0x20, 0x22, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20,
0x5b, 0x5b, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x37,
0x33, 0x2e, 0x39, 0x36, 0x2c, 0x20, 0x32, 0x37, 0x36, 0x2e,
0x37, 0x34, 0x2c, 0x20, 0x32, 0x36, 0x37, 0x2e, 0x36, 0x32,
0x2c, 0x20, 0x32, 0x37, 0x35, 0x2e, 0x37, 0x31, 0x5d, 0x2c,
0x20, 0x5b, 0x33, 0x33, 0x34, 0x2e, 0x39, 0x35, 0x2c, 0x20,
0x33, 0x34, 0x34, 0x2e, 0x34, 0x34, 0x2c, 0x20, 0x33, 0x34,
0x35, 0x2e, 0x32, 0x38, 0x2c, 0x20, 0x33, 0x33, 0x31, 0x2e,
0x37, 0x32, 0x5d, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22, 0x63,
0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x72, 0x69,
0x67, 0x68, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2c, 0x20,
0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22,
0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22,
0x3a, 0x20, 0x5b, 0x32, 0x38, 0x38, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32,
0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69,
0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x6c, 0x65, 0x66, 0x74,
0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x2c,
0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22, 0x66, 0x65, 0x61,
0x74, 0x75, 0x72, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x5b,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x36, 0x39, 0x2e,
0x31, 0x33, 0x2c, 0x20, 0x32, 0x37, 0x31, 0x2e, 0x35, 0x34,
0x2c, 0x20, 0x32, 0x36, 0x31, 0x2e, 0x34, 0x34, 0x2c, 0x20,
0x32, 0x37, 0x31, 0x2e, 0x35, 0x39, 0x5d, 0x2c, 0x20, 0x5b,
0x33, 0x33, 0x34, 0x2e, 0x39, 0x35, 0x2c, 0x20, 0x33, 0x34,
0x34, 0x2e, 0x34, 0x34, 0x2c, 0x20, 0x33, 0x34, 0x35, 0x2e,
0x32, 0x38, 0x2c, 0x20, 0x33, 0x33, 0x31, 0x2e, 0x37, 0x32,
0x5d, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22, 0x63, 0x68, 0x69,
0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x72, 0x69, 0x67, 0x68,
0x74, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2c, 0x20, 0x2d, 0x31,
0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22, 0x74, 0x68,
0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22, 0x3a, 0x20,
0x5b, 0x31, 0x36, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d,
0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30,
0x30, 0x5d, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64,
0x72, 0x65, 0x6e, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x22, 0x3a,
0x20, 0x5b, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x2d,
0x31, 0x5d, 0x2c, 0x20, 0x22, 0x66, 0x65, 0x61, 0x74, 0x75,
0x72, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d,
0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x30, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x35, 0x34, 0x2e, 0x36, 0x36,
0x2c, 0x20, 0x32, 0x35, 0x35, 0x2e, 0x39, 0x33, 0x2c, 0x20,
0x32, 0x34, 0x32, 0x2e, 0x38, 0x39, 0x2c, 0x20, 0x32, 0x35,
0x39, 0x2e, 0x32, 0x32, 0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x38,
0x33, 0x2e, 0x36, 0x31, 0x2c, 0x20, 0x32, 0x38, 0x37, 0x2e,
0x31, 0x35, 0x2c, 0x20, 0x32, 0x37, 0x39, 0x2e, 0x39, 0x39,
0x2c, 0x20, 0x32, 0x38, 0x33, 0x2e, 0x39, 0x35, 0x5d, 0x5d,
0x7d, 0x5d, 0x2c, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x66, 0x69,
0x6c, 0x65, 0x73, 0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x34, 0x2c,
0x20, 0x38, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x38, 0x2c, 0x20,
0x31, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38,
0x2c, 0x20, 0x30, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x31, 0x36,
0x2c, 0x20, 0x34, 0x5d, 0x2c, 0x20, 0x5b, 0x34, 0x2c, 0x20,
0x38, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31,
0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38, 0x2c,
0x20, 0x30, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x38, 0x2c, 0x20,
0x38, 0x5d, 0x2c, 0x20, 0x5b, 0x34, 0x2c, 0x20, 0x38, 0x2c,
0x20, 0x31, 0x36, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31, 0x2c,
0x20, 0x38, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38, 0x2c, 0x20,
0x30, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x38,
0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x2c, 0x20, 0x38, 0x2c, 0x20,
0x38, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38,
0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x30, 0x2c,
0x20, 0x30, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x38, 0x5d, 0x5d,
0x7d, 0x7d, 0x2c, 0x20, 0x22, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x22, 0x3a, 0x20, 0x22, 0x31, 0x2e, 0x30, 0x22,
0x2c, 0x20, 0x22, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x74, 0x6e,
0x22, 0x3a, 0x20, 0x7b, 0x22, 0x66, 0x6c, 0x6f, 0x61, 0x74,
0x33, 0x32, 0x22, 0x3a, 0x20, 0x7b, 0x22, 0x70, 0x72, 0x65,
0x64, 0x69, 0x63, 0x74, 0x6f, 0x72, 0x22, 0x3a, 0x20, 0x5b,
0x7b, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e,
0x5f, 0x72, 0x69, 0x67, 0x68, 0x74, 0x22, 0x3a, 0x20, 0x5b,
0x32, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d,
0x2c, 0x20, 0x22, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f,
0x6c, 0x64, 0x22, 0x3a, 0x20, 0x5b, 0x34, 0x34, 0x39, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22,
0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x6c,
0x65, 0x66, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20,
0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22,
0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3a, 0x20,
0x5b, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d,
0x2c, 0x20, 0x22, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a,
0x20, 0x5b, 0x5b, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d,
0x2c, 0x20, 0x5b, 0x31, 0x39, 0x39, 0x2e, 0x38, 0x36, 0x2c,
0x20, 0x31, 0x37, 0x34, 0x2e, 0x38, 0x37, 0x2c, 0x20, 0x37,
0x35, 0x2e, 0x33, 0x36, 0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x32,
0x35, 0x2e, 0x38, 0x34, 0x2c, 0x20, 0x31, 0x39, 0x30, 0x2e,
0x34, 0x33, 0x2c, 0x20, 0x31, 0x35, 0x31, 0x2e, 0x31, 0x37,
0x5d, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22, 0x63, 0x68, 0x69,
0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x72, 0x69, 0x67, 0x68,
0x74, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2c, 0x20, 0x2d, 0x31,
0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22, 0x74, 0x68,
0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22, 0x3a, 0x20,
0x5b, 0x31, 0x35, 0x39, 0x37, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e,
0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69, 0x6c,
0x64, 0x72, 0x65, 0x6e, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x22,
0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20,
0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22, 0x66, 0x65, 0x61, 0x74,
0x75, 0x72, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2e, 0x30,
0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x30,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b, 0x32,
0x31, 0x38, 0x2e, 0x39, 0x36, 0x2c, 0x20, 0x31, 0x39, 0x32,
0x2e, 0x32, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d,
0x2c, 0x20, 0x5b, 0x31, 0x30, 0x37, 0x2e, 0x33, 0x35, 0x2c,
0x20, 0x31, 0x31, 0x31, 0x2e, 0x36, 0x37, 0x2c, 0x20, 0x31,
0x37, 0x35, 0x2e, 0x38, 0x31, 0x5d, 0x5d, 0x7d, 0x5d, 0x2c,
0x20, 0x22, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x73,
0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x31, 0x2c, 0x20, 0x34, 0x2c,
0x20, 0x34, 0x2c, 0x20, 0x31, 0x36, 0x2c, 0x20, 0x31, 0x2c,
0x20, 0x38, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38, 0x2c, 0x20,
0x30, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x33,
0x32, 0x5d, 0x2c, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x38, 0x2c,
0x20, 0x38, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31, 0x2c, 0x20,
0x34, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x30,
0x2c, 0x20, 0x30, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x38, 0x5d,
0x2c, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x31, 0x36, 0x2c, 0x20,
0x38, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x34,
0x2c, 0x20, 0x32, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x30, 0x2c,
0x20, 0x30, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x38, 0x5d, 0x5d,
0x7d, 0x7d, 0x2c, 0x20, 0x22, 0x67, 0x65, 0x6d, 0x6d, 0x5f,
0x6e, 0x6e, 0x22, 0x3a, 0x20, 0x7b, 0x22, 0x66, 0x6c, 0x6f,
0x61, 0x74, 0x33, 0x32, 0x22, 0x3a, 0x20, 0x7b, 0x22, 0x70,
0x72, 0x65, 0x64, 0x69, 0x63, 0x74, 0x6f, 0x72, 0x22, 0x3a,
0x20, 0x5b, 0x7b, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72,
0x65, 0x6e, 0x5f, 0x72, 0x69, 0x67, 0x68, 0x74, 0x22, 0x3a,
0x20, 0x5b, 0x32, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x34,
0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c,
0x20, 0x22, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c,
0x64, 0x22, 0x3a, 0x20, 0x5b, 0x37, 0x38, 0x31, 0x2e, 0x35,
0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x34, 0x34, 0x39, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30,
0x5d, 0x2c, 0x20, 0x22, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
0x3a, 0x20, 0x5b, 0x5b, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x36, 0x39, 0x2e,
0x35, 0x39, 0x2c, 0x20, 0x32, 0x33, 0x39, 0x2e, 0x31, 0x38,
0x2c, 0x20, 0x31, 0x34, 0x32, 0x2e, 0x32, 0x32, 0x2c, 0x20,
0x31, 0x35, 0x32, 0x2e, 0x39, 0x39, 0x2c, 0x20, 0x31, 0x36,
0x33, 0x2e, 0x37, 0x33, 0x5d, 0x2c, 0x20, 0x5b, 0x30, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b,
0x31, 0x38, 0x33, 0x2e, 0x34, 0x32, 0x2c, 0x20, 0x31, 0x37,
0x38, 0x2e, 0x39, 0x37, 0x2c, 0x20, 0x32, 0x30, 0x31, 0x2e,
0x35, 0x30, 0x2c, 0x20, 0x32, 0x33, 0x31, 0x2e, 0x34, 0x32,
0x2c, 0x20, 0x32, 0x37, 0x35, 0x2e, 0x34, 0x30, 0x5d, 0x2c,
0x20, 0x5b, 0x32, 0x30, 0x36, 0x2e, 0x36, 0x30, 0x2c, 0x20,
0x33, 0x34, 0x31, 0x2e, 0x34, 0x35, 0x2c, 0x20, 0x32, 0x30,
0x37, 0x2e, 0x35, 0x34, 0x2c, 0x20, 0x32, 0x34, 0x32, 0x2e,
0x33, 0x37, 0x2c, 0x20, 0x32, 0x38, 0x38, 0x2e, 0x34, 0x34,
0x5d, 0x5d, 0x2c, 0x20, 0x22, 0x66, 0x65, 0x61, 0x74, 0x75,
0x72, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20,
0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f,
0x6c, 0x65, 0x66, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c,
0x20, 0x2d, 0x31, 0x2c, 0x20, 0x33, 0x2c, 0x20, 0x2d, 0x31,
0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22,
0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x72,
0x69, 0x67, 0x68, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2c,
0x20, 0x2d, 0x31, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x2d, 0x31,
0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22, 0x74, 0x68,
0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22, 0x3a, 0x20,
0x5b, 0x31, 0x31, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d,
0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x32, 0x35, 0x36, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x5b,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c,
0x20, 0x5b, 0x32, 0x36, 0x39, 0x2e, 0x35, 0x39, 0x2c, 0x20,
0x32, 0x33, 0x39, 0x2e, 0x31, 0x38, 0x2c, 0x20, 0x31, 0x34,
0x32, 0x2e, 0x32, 0x32, 0x2c, 0x20, 0x31, 0x35, 0x32, 0x2e,
0x39, 0x39, 0x2c, 0x20, 0x31, 0x36, 0x33, 0x2e, 0x37, 0x33,
0x5d, 0x2c, 0x20, 0x5b, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b, 0x31, 0x32, 0x31, 0x2e,
0x34, 0x34, 0x2c, 0x20, 0x31, 0x30, 0x38, 0x2e, 0x39, 0x33,
0x2c, 0x20, 0x31, 0x39, 0x35, 0x2e, 0x34, 0x32, 0x2c, 0x20,
0x32, 0x31, 0x30, 0x2e, 0x36, 0x31, 0x2c, 0x20, 0x32, 0x34,
0x34, 0x2e, 0x39, 0x32, 0x5d, 0x2c, 0x20, 0x5b, 0x32, 0x34,
0x35, 0x2e, 0x34, 0x31, 0x2c, 0x20, 0x32, 0x34, 0x39, 0x2e,
0x30, 0x32, 0x2c, 0x20, 0x32, 0x30, 0x37, 0x2e, 0x35, 0x37,
0x2c, 0x20, 0x32, 0x35, 0x32, 0x2e, 0x32, 0x33, 0x2c, 0x20,
0x33, 0x30, 0x35, 0x2e, 0x38, 0x37, 0x5d, 0x5d, 0x2c, 0x20,
0x22, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3a,
0x20, 0x5b, 0x31, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32,
0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69,
0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x6c, 0x65, 0x66, 0x74,
0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x2c,
0x20, 0x33, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31,
0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22, 0x63, 0x68, 0x69, 0x6c,
0x64, 0x72, 0x65, 0x6e, 0x5f, 0x72, 0x69, 0x67, 0x68, 0x74,
0x22, 0x3a, 0x20, 0x5b, 0x34, 0x2c, 0x20, 0x33, 0x2c, 0x20,
0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x36, 0x2c,
0x20, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20,
0x22, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64,
0x22, 0x3a, 0x20, 0x5b, 0x34, 0x34, 0x39, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x31, 0x36, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x31, 0x38, 0x37, 0x37, 0x2e, 0x30,
0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x30,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30,
0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20,
0x5b, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30,
0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d,
0x2c, 0x20, 0x5b, 0x31, 0x32, 0x31, 0x2e, 0x34, 0x34, 0x2c,
0x20, 0x31, 0x30, 0x38, 0x2e, 0x39, 0x33, 0x2c, 0x20, 0x31,
0x39, 0x35, 0x2e, 0x34, 0x32, 0x2c, 0x20, 0x32, 0x31, 0x30,
0x2e, 0x36, 0x31, 0x2c, 0x20, 0x32, 0x34, 0x34, 0x2e, 0x39,
0x32, 0x5d, 0x2c, 0x20, 0x5b, 0x31, 0x37, 0x31, 0x2e, 0x37,
0x32, 0x2c, 0x20, 0x31, 0x36, 0x37, 0x2e, 0x34, 0x30, 0x2c,
0x20, 0x31, 0x35, 0x31, 0x2e, 0x36, 0x36, 0x2c, 0x20, 0x32,
0x33, 0x32, 0x2e, 0x31, 0x36, 0x2c, 0x20, 0x32, 0x36, 0x37,
0x2e, 0x35, 0x32, 0x5d, 0x2c, 0x20, 0x5b, 0x30, 0x2e, 0x30,
0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b, 0x32,
0x30, 0x36, 0x2e, 0x36, 0x30, 0x2c, 0x20, 0x33, 0x34, 0x31,
0x2e, 0x34, 0x35, 0x2c, 0x20, 0x32, 0x30, 0x37, 0x2e, 0x35,
0x34, 0x2c, 0x20, 0x32, 0x34, 0x32, 0x2e, 0x33, 0x37, 0x2c,
0x20, 0x32, 0x38, 0x38, 0x2e, 0x34, 0x34, 0x5d, 0x2c, 0x20,
0x5b, 0x32, 0x36, 0x39, 0x2e, 0x35, 0x39, 0x2c, 0x20, 0x32,
0x33, 0x39, 0x2e, 0x31, 0x38, 0x2c, 0x20, 0x31, 0x34, 0x32,
0x2e, 0x32, 0x32, 0x2c, 0x20, 0x31, 0x35, 0x32, 0x2e, 0x39,
0x39, 0x2c, 0x20, 0x31, 0x36, 0x33, 0x2e, 0x37, 0x33, 0x5d,
0x5d, 0x2c, 0x20, 0x22, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72,
0x65, 0x22, 0x3a, 0x20, 0x5b, 0x30, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x31, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d,
0x2c, 0x20, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65,
0x6e, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x22, 0x3a, 0x20, 0x5b,
0x31, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20,
0x2d, 0x31, 0x2c, 0x20, 0x35, 0x2c, 0x20, 0x2d, 0x31, 0x2c,
0x20, 0x2d, 0x31, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22, 0x63,
0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x72, 0x69,
0x67, 0x68, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2c, 0x20,
0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22,
0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22,
0x3a, 0x20, 0x5b, 0x31, 0x38, 0x37, 0x37, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d,
0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x30, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b,
0x32, 0x30, 0x36, 0x2e, 0x36, 0x30, 0x2c, 0x20, 0x33, 0x34,
0x31, 0x2e, 0x34, 0x35, 0x2c, 0x20, 0x32, 0x30, 0x37, 0x2e,
0x35, 0x34, 0x2c, 0x20, 0x32, 0x34, 0x32, 0x2e, 0x33, 0x37,
0x2c, 0x20, 0x32, 0x38, 0x38, 0x2e, 0x34, 0x34, 0x5d, 0x2c,
0x20, 0x5b, 0x32, 0x36, 0x39, 0x2e, 0x35, 0x39, 0x2c, 0x20,
0x32, 0x33, 0x39, 0x2e, 0x31, 0x38, 0x2c, 0x20, 0x31, 0x34,
0x32, 0x2e, 0x32, 0x32, 0x2c, 0x20, 0x31, 0x35, 0x32, 0x2e,
0x39, 0x39, 0x2c, 0x20, 0x31, 0x36, 0x33, 0x2e, 0x37, 0x33,
0x5d, 0x5d, 0x2c, 0x20, 0x22, 0x66, 0x65, 0x61, 0x74, 0x75,
0x72, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d,
0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x63, 0x68,
0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x6c, 0x65, 0x66,
0x74, 0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x2d, 0x31,
0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22,
0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x72,
0x69, 0x67, 0x68, 0x74, 0x22, 0x3a, 0x20, 0x5b, 0x32, 0x2c,
0x20, 0x2d, 0x31, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x2d, 0x31,
0x2c, 0x20, 0x2d, 0x31, 0x5d, 0x2c, 0x20, 0x22, 0x74, 0x68,
0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22, 0x3a, 0x20,
0x5b, 0x31, 0x31, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d,
0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x31, 0x36, 0x30, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x20, 0x5b, 0x5b,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x5d, 0x2c,
0x20, 0x5b, 0x32, 0x36, 0x39, 0x2e, 0x35, 0x39, 0x2c, 0x20,
0x32, 0x33, 0x39, 0x2e, 0x31, 0x38, 0x2c, 0x20, 0x31, 0x34,
0x32, 0x2e, 0x32, 0x32, 0x2c, 0x20, 0x31, 0x35, 0x32, 0x2e,
0x39, 0x39, 0x2c, 0x20, 0x31, 0x36, 0x33, 0x2e, 0x37, 0x33,
0x5d, 0x2c, 0x20, 0x5b, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20,
0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30,
0x2c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x30, 0x5d, 0x2c, 0x20, 0x5b, 0x31, 0x32, 0x31, 0x2e,
0x34, 0x34, 0x2c, 0x20, 0x31, 0x30, 0x38, 0x2e, 0x39, 0x33,
0x2c, 0x20, 0x31, 0x39, 0x35, 0x2e, 0x34, 0x32, 0x2c, 0x20,
0x32, 0x31, 0x30, 0x2e, 0x36, 0x31, 0x2c, 0x20, 0x32, 0x34,
0x34, 0x2e, 0x39, 0x32, 0x5d, 0x2c, 0x20, 0x5b, 0x31, 0x37,
0x31, 0x2e, 0x37, 0x32, 0x2c, 0x20, 0x31, 0x36, 0x37, 0x2e,
0x34, 0x30, 0x2c, 0x20, 0x31, 0x35, 0x31, 0x2e, 0x36, 0x36,
0x2c, 0x20, 0x32, 0x33, 0x32, 0x2e, 0x31, 0x36, 0x2c, 0x20,
0x32, 0x36, 0x37, 0x2e, 0x35, 0x32, 0x5d, 0x5d, 0x2c, 0x20,
0x22, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3a,
0x20, 0x5b, 0x31, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32,
0x2e, 0x30, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x30, 0x2c,
0x20, 0x2d, 0x32, 0x2e, 0x30, 0x30, 0x2c, 0x20, 0x2d, 0x32,
0x2e, 0x30, 0x30, 0x5d, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69,
0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x6c, 0x65, 0x66, 0x74,
0x22, 0x3a, 0x20, 0x5b, 0x31, 0x2c, 0x20, 0x2d, 0x31, 0x2c,
0x20, 0x33, 0x2c, 0x20, 0x2d, 0x31, 0x2c, 0x20, 0x2d, 0x31,
0x5d, 0x7d, 0x5d, 0x2c, 0x20, 0x22, 0x70, 0x72, 0x6f, 0x66,
0x69, 0x6c, 0x65, 0x73, 0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x32,
0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31, 0x36, 0x2c, 0x20, 0x38,
0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x32, 0x2c,
0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x30, 0x2c, 0x20,
0x38, 0x2c, 0x20, 0x38, 0x5d, 0x2c, 0x20, 0x5b, 0x34, 0x2c,
0x20, 0x38, 0x2c, 0x20, 0x33, 0x32, 0x2c, 0x20, 0x31, 0x36,
0x2c, 0x20, 0x31, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x32, 0x2c,
0x20, 0x38, 0x2c, 0x20, 0x30, 0x2c, 0x20, 0x30, 0x2c, 0x20,
0x34, 0x2c, 0x20, 0x33, 0x32, 0x5d, 0x2c, 0x20, 0x5b, 0x32,
0x2c, 0x20, 0x31, 0x36, 0x2c, 0x20, 0x31, 0x32, 0x38, 0x2c,
0x20, 0x31, 0x36, 0x2c, 0x20, 0x31, 0x2c, 0x20, 0x34, 0x2c,
0x20, 0x34, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c, 0x20,
0x30, 0x2c, 0x20, 0x33, 0x32, 0x2c, 0x20, 0x38, 0x5d, 0x2c,
0x20, 0x5b, 0x34, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x31, 0x36,
0x2c, 0x20, 0x31, 0x36, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x38,
0x2c, 0x20, 0x34, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x30, 0x2c,
0x20, 0x30, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x31, 0x36, 0x5d,
0x2c, 0x20, 0x5b, 0x34, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x31,
0x36, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x38,
0x2c, 0x20, 0x32, 0x2c, 0x20, 0x38, 0x2c, 0x20, 0x30, 0x2c,
0x20, 0x30, 0x2c, 0x20, 0x34, 0x2c, 0x20, 0x31, 0x36, 0x5d,
0x5d, 0x7d, 0x7d, 0x2c, 0x20, 0x22, 0x67, 0x65, 0x72, 0x22,
0x3a, 0x20, 0x7b, 0x22, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33,
0x32, 0x22, 0x3a, 0x20, 0x7b, 0x22, 0x70, 0x72, 0x6f, 0x66,
0x69, 0x6c, 0x65, 0x73, 0x22, 0x3a, 0x20, 0x5b, 0x5b, 0x31,
0x2c, 0x20, 0x31, 0x32, 0x38, 0x2c, 0x20, 0x31, 0x2c, 0x20,
0x31, 0x36, 0x2c, 0x20, 0x33, 0x32, 0x2c, 0x20, 0x31, 0x5d,
0x5d, 0x7d, 0x7d, 0x7d, };
static const std::size_t broadwell_len = 3744;
}
}

View File

@@ -0,0 +1 @@
{"gemm_nt": {"float32": {"predictor": [{"children_right": [2, -1, -1], "threshold": [288.00, -2.00, -2.00], "children_left": [1, -1, -1], "feature": [2.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00], [273.96, 276.74, 267.62, 275.71], [334.95, 344.44, 345.28, 331.72]]}, {"children_right": [2, -1, -1], "threshold": [288.00, -2.00, -2.00], "children_left": [1, -1, -1], "feature": [2.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00], [269.13, 271.54, 261.44, 271.59], [334.95, 344.44, 345.28, 331.72]]}, {"children_right": [2, -1, -1], "threshold": [160.00, -2.00, -2.00], "children_left": [1, -1, -1], "feature": [2.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00], [254.66, 255.93, 242.89, 259.22], [283.61, 287.15, 279.99, 283.95]]}], "profiles": [[4, 8, 4, 8, 1, 8, 1, 8, 0, 0, 16, 4], [4, 8, 8, 8, 1, 8, 1, 8, 0, 0, 8, 8], [4, 8, 16, 8, 1, 8, 1, 8, 0, 0, 8, 8], [2, 8, 8, 8, 1, 8, 1, 8, 0, 0, 8, 8]]}}, "version": "1.0", "gemm_tn": {"float32": {"predictor": [{"children_right": [2, -1, -1], "threshold": [449.00, -2.00, -2.00], "children_left": [1, -1, -1], "feature": [2.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00], [199.86, 174.87, 75.36], [225.84, 190.43, 151.17]]}, {"children_right": [2, -1, -1], "threshold": [1597.00, -2.00, -2.00], "children_left": [1, -1, -1], "feature": [2.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00], [218.96, 192.24, 0.00], [107.35, 111.67, 175.81]]}], "profiles": [[1, 4, 4, 16, 1, 8, 1, 8, 0, 0, 2, 32], [1, 8, 8, 8, 1, 4, 1, 8, 0, 0, 8, 8], [1, 16, 8, 4, 8, 4, 2, 8, 0, 0, 8, 8]]}}, "gemm_nn": {"float32": {"predictor": [{"children_right": [2, -1, 4, -1, -1], "threshold": [781.50, -2.00, 449.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00, 0.00], [269.59, 239.18, 142.22, 152.99, 163.73], [0.00, 0.00, 0.00, 0.00, 0.00], [183.42, 178.97, 201.50, 231.42, 275.40], [206.60, 341.45, 207.54, 242.37, 288.44]], "feature": [2.00, -2.00, 0.00, -2.00, -2.00], "children_left": [1, -1, 3, -1, -1]}, {"children_right": [2, -1, 4, -1, -1], "threshold": [112.00, -2.00, 256.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00, 0.00], [269.59, 239.18, 142.22, 152.99, 163.73], [0.00, 0.00, 0.00, 0.00, 0.00], [121.44, 108.93, 195.42, 210.61, 244.92], [245.41, 249.02, 207.57, 252.23, 305.87]], "feature": [1.00, -2.00, 1.00, -2.00, -2.00], "children_left": [1, -1, 3, -1, -1]}, {"children_right": [4, 3, -1, -1, 6, -1, -1], "threshold": [449.00, 160.00, -2.00, -2.00, 1877.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00, 0.00], [0.00, 0.00, 0.00, 0.00, 0.00], [121.44, 108.93, 195.42, 210.61, 244.92], [171.72, 167.40, 151.66, 232.16, 267.52], [0.00, 0.00, 0.00, 0.00, 0.00], [206.60, 341.45, 207.54, 242.37, 288.44], [269.59, 239.18, 142.22, 152.99, 163.73]], "feature": [0.00, 1.00, -2.00, -2.00, 0.00, -2.00, -2.00], "children_left": [1, 2, -1, -1, 5, -1, -1]}, {"children_right": [2, -1, -1], "threshold": [1877.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00, 0.00], [206.60, 341.45, 207.54, 242.37, 288.44], [269.59, 239.18, 142.22, 152.99, 163.73]], "feature": [0.00, -2.00, -2.00], "children_left": [1, -1, -1]}, {"children_right": [2, -1, 4, -1, -1], "threshold": [112.00, -2.00, 160.00, -2.00, -2.00], "value": [[0.00, 0.00, 0.00, 0.00, 0.00], [269.59, 239.18, 142.22, 152.99, 163.73], [0.00, 0.00, 0.00, 0.00, 0.00], [121.44, 108.93, 195.42, 210.61, 244.92], [171.72, 167.40, 151.66, 232.16, 267.52]], "feature": [1.00, -2.00, 1.00, -2.00, -2.00], "children_left": [1, -1, 3, -1, -1]}], "profiles": [[2, 8, 16, 8, 1, 8, 2, 4, 0, 0, 8, 8], [4, 8, 32, 16, 1, 8, 2, 8, 0, 0, 4, 32], [2, 16, 128, 16, 1, 4, 4, 4, 0, 0, 32, 8], [4, 4, 16, 16, 2, 8, 4, 4, 0, 0, 4, 16], [4, 8, 16, 8, 4, 8, 2, 8, 0, 0, 4, 16]]}}, "ger": {"float32": {"profiles": [[1, 128, 1, 16, 32, 1]]}}}

View File

@@ -20,6 +20,8 @@
#include "isaac/tools/timer.hpp" #include "isaac/tools/timer.hpp"
#include "isaac/tools/getenv.hpp" #include "isaac/tools/getenv.hpp"
#include "database/broadwell.hpp"
#include "convert.hpp" #include "convert.hpp"
@@ -278,7 +280,7 @@ std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<templates::ba
{ {
res[std::make_pair(AXPY_TYPE, DTYPE)] = ptr_t (new templates::axpy(1,64,128,templates::FETCH_FROM_GLOBAL_STRIDED)); res[std::make_pair(AXPY_TYPE, DTYPE)] = ptr_t (new templates::axpy(1,64,128,templates::FETCH_FROM_GLOBAL_STRIDED));
res[std::make_pair(DOT_TYPE, DTYPE)] = ptr_t(new templates::dot(1,64,128,templates::FETCH_FROM_GLOBAL_STRIDED)); res[std::make_pair(DOT_TYPE, DTYPE)] = ptr_t(new templates::dot(1,64,128,templates::FETCH_FROM_GLOBAL_STRIDED));
res[std::make_pair(GER_TYPE, DTYPE)] = ptr_t(new templates::ger(1,8,8,8,8,templates::FETCH_FROM_GLOBAL_STRIDED)); res[std::make_pair(GER_TYPE, DTYPE)] = ptr_t(new templates::ger(1,128,1,16,32,templates::FETCH_FROM_GLOBAL_STRIDED));
res[std::make_pair(GEMV_N_TYPE, DTYPE)] = ptr_t(new templates::gemv_n(1, 8, 8, 4, 16, templates::FETCH_FROM_GLOBAL_STRIDED)); res[std::make_pair(GEMV_N_TYPE, DTYPE)] = ptr_t(new templates::gemv_n(1, 8, 8, 4, 16, templates::FETCH_FROM_GLOBAL_STRIDED));
res[std::make_pair(GEMV_T_TYPE, DTYPE)] = ptr_t(new templates::gemv_t(1, 8, 8, 64, 8, templates::FETCH_FROM_GLOBAL_STRIDED)); res[std::make_pair(GEMV_T_TYPE, DTYPE)] = ptr_t(new templates::gemv_t(1, 8, 8, 64, 8, templates::FETCH_FROM_GLOBAL_STRIDED));
res[std::make_pair(GEMM_NN_TYPE, DTYPE)] = ptr_t(new templates::gemm_nn(1, 8, 16, 8, 1, 8, 1, 8, templates::FETCH_FROM_LOCAL, templates::FETCH_FROM_LOCAL, 8, 8, true)); res[std::make_pair(GEMM_NN_TYPE, DTYPE)] = ptr_t(new templates::gemm_nn(1, 8, 16, 8, 1, 8, 1, 8, templates::FETCH_FROM_LOCAL, templates::FETCH_FROM_LOCAL, 8, 8, true));
@@ -292,4 +294,7 @@ std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<templates::ba
std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<templates::base> > fallbacks = init_fallback(); std::map<std::pair<expression_type, numeric_type>, std::shared_ptr<templates::base> > fallbacks = init_fallback();
const std::map<std::pair<driver::Device::VENDOR, driver::Device::ARCHITECTURE> , const char *>
models::database_ = { { {driver::Device::VENDOR::INTEL, driver::Device::ARCHITECTURE::BROADWELL}, database::broadwell } };
} }

340
python/setup.py Executable file → Normal file
View File

@@ -1,170 +1,170 @@
#Thanks to Andreas Knoeckler for providing stand-alone boost.python #Thanks to Andreas Knoeckler for providing stand-alone boost.python
#through PyOpenCL and PyCUDA #through PyOpenCL and PyCUDA
import os, sys import os, sys
from distutils.ccompiler import show_compilers,new_compiler from distutils.ccompiler import show_compilers,new_compiler
from distutils.command.build_ext import build_ext from distutils.command.build_ext import build_ext
from distutils.command.build_py import build_py from distutils.command.build_py import build_py
from distutils.core import setup, Extension from distutils.core import setup, Extension
from distutils.sysconfig import get_python_inc from distutils.sysconfig import get_python_inc
from distutils import sysconfig from distutils import sysconfig
from imp import find_module from imp import find_module
from glob import glob from glob import glob
from os.path import dirname from os.path import dirname
platform_cflags = {} platform_cflags = {}
platform_ldflags = {} platform_ldflags = {}
platform_libs = {} platform_libs = {}
class build_ext_subclass(build_ext): class build_ext_subclass(build_ext):
def build_extensions(self): def build_extensions(self):
c = self.compiler.compiler_type c = self.compiler.compiler_type
if c in platform_cflags.keys(): if c in platform_cflags.keys():
for e in self.extensions: for e in self.extensions:
e.extra_compile_args = platform_cflags[c] e.extra_compile_args = platform_cflags[c]
if c in platform_ldflags.keys(): if c in platform_ldflags.keys():
for e in self.extensions: for e in self.extensions:
e.extra_link_args = platform_ldflags[c] e.extra_link_args = platform_ldflags[c]
if c in platform_libs.keys(): if c in platform_libs.keys():
for e in self.extensions: for e in self.extensions:
try: try:
e.libraries += platform_libs[c] e.libraries += platform_libs[c]
except: except:
e.libraries = platform_libs[c] e.libraries = platform_libs[c]
build_ext.build_extensions(self) build_ext.build_extensions(self)
def main(): def main():
def recursive_glob(rootdir='.', suffix=''): def recursive_glob(rootdir='.', suffix=''):
return [os.path.join(looproot, filename) return [os.path.join(looproot, filename)
for looproot, _, filenames in os.walk(rootdir) for looproot, _, filenames in os.walk(rootdir)
for filename in filenames if filename.endswith(suffix)] for filename in filenames if filename.endswith(suffix)]
def remove_prefixes(optlist, bad_prefixes): def remove_prefixes(optlist, bad_prefixes):
for bad_prefix in bad_prefixes: for bad_prefix in bad_prefixes:
for i, flag in enumerate(optlist): for i, flag in enumerate(optlist):
if flag.startswith(bad_prefix): if flag.startswith(bad_prefix):
optlist.pop(i) optlist.pop(i)
break break
return optlist return optlist
def find_library(name, cmake_glob_list): def find_library(name, cmake_glob_list):
cvars = sysconfig.get_config_vars() cvars = sysconfig.get_config_vars()
compiler = new_compiler() compiler = new_compiler()
dirs = [] dirs = []
for gpath in cmake_glob_list.split(';'): for gpath in cmake_glob_list.split(';'):
path = glob(gpath) path = glob(gpath)
if path: if path:
dirs += [path[0]] dirs += [path[0]]
return compiler.find_library_file(cvars['LIBDIR'].split(';') + dirs, name) return compiler.find_library_file(cvars['LIBDIR'].split(';') + dirs, name)
def find_opencl(): def find_opencl():
cvars = sysconfig.get_config_vars() cvars = sysconfig.get_config_vars()
is_on_android = '-mandroid' in cvars['PY_CFLAGS'] is_on_android = '-mandroid' in cvars['PY_CFLAGS']
lib = find_library('OpenCL', '' if is_on_android else '/opt/AMDAPPSDK*/lib/x86_64') lib = find_library('OpenCL', '' if is_on_android else '/opt/AMDAPPSDK*/lib/x86_64')
return {'include': '', 'lib': dirname(lib)} if lib else None return {'include': '', 'lib': dirname(lib)} if lib else None
def find_in_path(name, path): def find_in_path(name, path):
"Find a file in a search path" "Find a file in a search path"
#adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/ #adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
for dir in path.split(os.pathsep): for dir in path.split(os.pathsep):
binpath = os.path.join(dir, name) binpath = os.path.join(dir, name)
if os.path.exists(binpath): if os.path.exists(binpath):
return os.path.abspath(binpath) return os.path.abspath(binpath)
return None return None
def find_cuda(): def find_cuda():
if 'CUDAHOME' in os.environ: if 'CUDAHOME' in os.environ:
home = os.environ['CUDAHOME'] home = os.environ['CUDAHOME']
nvcc = os.path.join(home, 'bin', 'nvcc') nvcc = os.path.join(home, 'bin', 'nvcc')
else: else:
nvcc = find_in_path('nvcc', os.environ['PATH']) nvcc = find_in_path('nvcc', os.environ['PATH'])
if nvcc: if nvcc:
home = dirname(os.path.dirname(nvcc)) home = dirname(os.path.dirname(nvcc))
return {'include': os.path.join(home, 'include'), return {'include': os.path.join(home, 'include'),
'lib': os.path.join(home, 'lib64')} 'lib': os.path.join(home, 'lib64')}
else: else:
return None return None
#Tweaks warning, because boost-numpy and boost-python won't compile cleanly without these changes #Tweaks warning, because boost-numpy and boost-python won't compile cleanly without these changes
cvars = sysconfig.get_config_vars() cvars = sysconfig.get_config_vars()
cvars['OPT'] = str.join(' ', remove_prefixes(cvars['OPT'].split(), ['-g', '-Wstrict-prototypes'])) cvars['OPT'] = str.join(' ', remove_prefixes(cvars['OPT'].split(), ['-g', '-Wstrict-prototypes']))
cvars["CFLAGS"] = cvars["BASECFLAGS"] + ' ' + cvars['OPT'] cvars["CFLAGS"] = cvars["BASECFLAGS"] + ' ' + cvars['OPT']
cvars["LDFLAGS"] = '-Wl,--no-as-needed ' + cvars["LDFLAGS"] cvars["LDFLAGS"] = '-Wl,--no-as-needed ' + cvars["LDFLAGS"]
#OpenCL #OpenCL
opencl_config = find_opencl() opencl_config = find_opencl()
#CUDA #CUDA
cuda_config = find_cuda() cuda_config = find_cuda()
#Libraries #Libraries
libraries = ['OpenCL'] libraries = ['OpenCL']
if cuda_config: libraries += ['cuda', 'nvrtc'] if cuda_config: libraries += ['cuda', 'nvrtc']
#Backends: #Backends:
backend_defines = ['-DISAAC_WITH_OPENCL'] backend_defines = ['-DISAAC_WITH_OPENCL']
if cuda_config: backend_defines += ['-DISAAC_WITH_CUDA'] if cuda_config: backend_defines += ['-DISAAC_WITH_CUDA']
#Library directories #Library directories
library_dirs = [config['lib'] for config in [opencl_config, cuda_config] if config is not None] library_dirs = [config['lib'] for config in [opencl_config, cuda_config] if config is not None]
#Include directories #Include directories
include =' src/include'.split() + ['external/boost/include', os.path.join(find_module("numpy")[1], "core", "include")] include =' src/include'.split() + ['external/boost/include', os.path.join(find_module("numpy")[1], "core", "include")]
#Source files #Source files
src = 'src/lib/wrap/clBLAS.cpp src/lib/value_scalar.cpp src/lib/symbolic/preset.cpp src/lib/symbolic/io.cpp src/lib/symbolic/expression.cpp src/lib/symbolic/execute.cpp src/lib/model/predictors/random_forest.cpp src/lib/model/model.cpp src/lib/kernels/templates/ger.cpp src/lib/kernels/templates/gemv.cpp src/lib/kernels/templates/gemm.cpp src/lib/kernels/templates/dot.cpp src/lib/kernels/templates/base.cpp src/lib/kernels/templates/axpy.cpp src/lib/kernels/stream.cpp src/lib/kernels/parse.cpp src/lib/kernels/mapped_object.cpp src/lib/kernels/keywords.cpp src/lib/kernels/binder.cpp src/lib/exception/unknown_datatype.cpp src/lib/exception/operation_not_supported.cpp src/lib/driver/program_cache.cpp src/lib/driver/program.cpp src/lib/driver/platform.cpp src/lib/driver/ndrange.cpp src/lib/driver/kernel.cpp src/lib/driver/handle.cpp src/lib/driver/event.cpp src/lib/driver/device.cpp src/lib/driver/context.cpp src/lib/driver/command_queue.cpp src/lib/driver/check.cpp src/lib/driver/buffer.cpp src/lib/driver/backend.cpp src/lib/array.cpp '.split() + [os.path.join('src', 'wrap', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'model.cpp', 'exceptions.cpp']] src = 'src/lib/wrap/clBLAS.cpp src/lib/value_scalar.cpp src/lib/kernels/parse.cpp src/lib/kernels/templates/gemm.cpp src/lib/kernels/templates/gemv.cpp src/lib/kernels/templates/ger.cpp src/lib/kernels/templates/dot.cpp src/lib/kernels/templates/axpy.cpp src/lib/kernels/templates/base.cpp src/lib/kernels/stream.cpp src/lib/kernels/mapped_object.cpp src/lib/kernels/keywords.cpp src/lib/kernels/binder.cpp src/lib/array.cpp src/lib/symbolic/preset.cpp src/lib/symbolic/expression.cpp src/lib/symbolic/execute.cpp src/lib/symbolic/io.cpp src/lib/model/model.cpp src/lib/model/predictors/random_forest.cpp src/lib/exception/unknown_datatype.cpp src/lib/exception/operation_not_supported.cpp src/lib/driver/device.cpp src/lib/driver/program.cpp src/lib/driver/event.cpp src/lib/driver/context.cpp src/lib/driver/program_cache.cpp src/lib/driver/platform.cpp src/lib/driver/ndrange.cpp src/lib/driver/kernel.cpp src/lib/driver/handle.cpp src/lib/driver/command_queue.cpp src/lib/driver/check.cpp src/lib/driver/buffer.cpp src/lib/driver/backend.cpp '.split() + [os.path.join('src', 'wrap', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'model.cpp', 'exceptions.cpp']]
boostsrc = 'external/boost/libs/' boostsrc = 'external/boost/libs/'
for s in ['numpy','python','smart_ptr','system','thread']: for s in ['numpy','python','smart_ptr','system','thread']:
src = src + [x for x in recursive_glob('external/boost/libs/' + s + '/src/','.cpp') if 'win32' not in x and 'pthread' not in x] src = src + [x for x in recursive_glob('external/boost/libs/' + s + '/src/','.cpp') if 'win32' not in x and 'pthread' not in x]
# make sure next line succeeds even on Windows # make sure next line succeeds even on Windows
src = [f.replace("\\", "/") for f in src] src = [f.replace("\\", "/") for f in src]
if sys.platform == "win32": if sys.platform == "win32":
src += glob(boostsrc + "/thread/src/win32/*.cpp") src += glob(boostsrc + "/thread/src/win32/*.cpp")
src += glob(boostsrc + "/thread/src/tss_null.cpp") src += glob(boostsrc + "/thread/src/tss_null.cpp")
else: else:
src += glob(boostsrc + "/thread/src/pthread/*.cpp") src += glob(boostsrc + "/thread/src/pthread/*.cpp")
src= [f for f in src if not f.endswith("once_atomic.cpp")] src= [f for f in src if not f.endswith("once_atomic.cpp")]
#Setup #Setup
setup( setup(
name='isaac', name='isaac',
version='1.0', version='1.0',
description="Input-specific architecture-aware computations", description="Input-specific architecture-aware computations",
author='Philippe Tillet', author='Philippe Tillet',
author_email='ptillet@g.harvard.edu', author_email='ptillet@g.harvard.edu',
license='MPL 2.0', license='MPL 2.0',
packages=["isaac"], packages=["isaac"],
ext_package="isaac", ext_package="isaac",
ext_modules=[Extension( ext_modules=[Extension(
'_isaac',src, '_isaac',src,
extra_compile_args= backend_defines + ['-std=c++11', '-Wno-unused-function', '-Wno-unused-local-typedefs', '-Wno-sign-compare'], extra_compile_args= backend_defines + ['-std=c++11', '-Wno-unused-function', '-Wno-unused-local-typedefs', '-Wno-sign-compare'],
extra_link_args=['-Wl,-soname=_isaac.so'], extra_link_args=['-Wl,-soname=_isaac.so'],
undef_macros=[], undef_macros=[],
include_dirs=include, include_dirs=include,
library_dirs=library_dirs, library_dirs=library_dirs,
libraries=libraries libraries=libraries
)], )],
cmdclass={'build_py': build_py, 'build_ext': build_ext_subclass}, cmdclass={'build_py': build_py, 'build_ext': build_ext_subclass},
classifiers=[ classifiers=[
'Environment :: Console', 'Environment :: Console',
'Development Status :: 1 - Experimental', 'Development Status :: 1 - Experimental',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'Intended Audience :: Other Audience', 'Intended Audience :: Other Audience',
'Intended Audience :: Science/Research', 'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License', 'License :: OSI Approved :: MIT License',
'Natural Language :: English', 'Natural Language :: English',
'Programming Language :: C++', 'Programming Language :: C++',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Mathematics', 'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics', 'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Machine Learning', 'Topic :: Scientific/Engineering :: Machine Learning',
] ]
) )
if __name__ == "__main__": if __name__ == "__main__":
main() main()