Code quality: more renaming
This commit is contained in:
@@ -13,13 +13,13 @@ B = sc.empty((K, N), sc.float32)
|
||||
queue = A.context.queues[0]
|
||||
|
||||
#Benchmark profile 1
|
||||
queue.profiles[sc.templates.gemm_nn, sc.float32] = sc.profile(templates.gemm_nn(1,8,16,8,1,8,1,8,templates.FETCH_FROM_LOCAL,templates.FETCH_FROM_LOCAL,8,8), sc.float32, queue)
|
||||
C, events = sc.driver.enqueue(sc.dot(A, B))
|
||||
queue.profiles[sc.templates.matrix_product_nn, sc.float32] = sc.profile(templates.gemm_nn(1,8,16,8,1,8,1,8,templates.FETCH_FROM_LOCAL,templates.FETCH_FROM_LOCAL,8,8), sc.float32, queue)
|
||||
C, events = sc.driver.enqueue(sc.reduce_1d(A, B))
|
||||
C.context.synchronize()
|
||||
print 'Profile 1 finished in', sum([e.elapsed_time for e in events])*1e-9, 's'
|
||||
|
||||
#Benchmark profile 2
|
||||
queue.profiles[sc.templates.gemm_nn, sc.float32] = sc.profile(templates.gemm_nn(1,8,16,16,1,8,1,8,templates.FETCH_FROM_LOCAL,templates.FETCH_FROM_LOCAL,8,16), sc.float32, queue)
|
||||
C, events = sc.driver.enqueue(sc.dot(A, B))
|
||||
queue.profiles[sc.templates.matrix_product_nn, sc.float32] = sc.profile(templates.gemm_nn(1,8,16,16,1,8,1,8,templates.FETCH_FROM_LOCAL,templates.FETCH_FROM_LOCAL,8,16), sc.float32, queue)
|
||||
C, events = sc.driver.enqueue(sc.reduce_1d(A, B))
|
||||
C.context.synchronize()
|
||||
print 'Profile 2 finished in', sum([e.elapsed_time for e in events])*1e-9, 's'
|
||||
|
@@ -73,7 +73,7 @@ def main():
|
||||
libraries += ['gnustl_shared']
|
||||
|
||||
#Source files
|
||||
src = 'src/lib/symbolic/preset.cpp src/lib/symbolic/execute.cpp src/lib/symbolic/io.cpp src/lib/symbolic/expression.cpp src/lib/array.cpp src/lib/value_scalar.cpp src/lib/driver/backend.cpp src/lib/driver/device.cpp src/lib/driver/kernel.cpp src/lib/driver/buffer.cpp src/lib/driver/platform.cpp src/lib/driver/check.cpp src/lib/driver/program.cpp src/lib/driver/command_queue.cpp src/lib/driver/dispatch.cpp src/lib/driver/program_cache.cpp src/lib/driver/context.cpp src/lib/driver/event.cpp src/lib/driver/ndrange.cpp src/lib/driver/handle.cpp src/lib/exception/unknown_datatype.cpp src/lib/exception/operation_not_supported.cpp src/lib/profiles/presets.cpp src/lib/profiles/profiles.cpp src/lib/profiles/predictors/random_forest.cpp src/lib/kernels/templates/reduce_2d.cpp src/lib/kernels/templates/elementwise_2d.cpp src/lib/kernels/templates/elementwise_1d.cpp src/lib/kernels/templates/reduce_1d.cpp src/lib/kernels/templates/matrix_product.cpp src/lib/kernels/templates/base.cpp src/lib/kernels/mapped_object.cpp src/lib/kernels/stream.cpp src/lib/kernels/parse.cpp src/lib/kernels/keywords.cpp src/lib/kernels/binder.cpp src/lib/wrap/clBLAS.cpp src/lib/wrap/cublas.cpp '.split() + [os.path.join('src', 'bind', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'kernels.cpp', 'exceptions.cpp']]
|
||||
src = 'src/lib/exception/operation_not_supported.cpp src/lib/exception/unknown_datatype.cpp src/lib/value_scalar.cpp src/lib/driver/check.cpp src/lib/driver/ndrange.cpp src/lib/driver/platform.cpp src/lib/driver/backend.cpp src/lib/driver/program.cpp src/lib/driver/command_queue.cpp src/lib/driver/event.cpp src/lib/driver/kernel.cpp src/lib/driver/handle.cpp src/lib/driver/device.cpp src/lib/driver/program_cache.cpp src/lib/driver/buffer.cpp src/lib/driver/context.cpp src/lib/driver/dispatch.cpp src/lib/kernels/templates/reduce_1d.cpp src/lib/kernels/templates/elementwise_1d.cpp src/lib/kernels/templates/base.cpp src/lib/kernels/templates/elementwise_2d.cpp src/lib/kernels/templates/matrix_product.cpp src/lib/kernels/templates/reduce_2d.cpp src/lib/kernels/stream.cpp src/lib/kernels/keywords.cpp src/lib/kernels/mapped_object.cpp src/lib/kernels/binder.cpp src/lib/kernels/parse.cpp src/lib/wrap/clBLAS.cpp src/lib/wrap/cublas.cpp src/lib/profiles/predictors/random_forest.cpp src/lib/profiles/presets.cpp src/lib/profiles/profiles.cpp src/lib/symbolic/execute.cpp src/lib/symbolic/expression.cpp src/lib/symbolic/io.cpp src/lib/symbolic/preset.cpp src/lib/array.cpp '.split() + [os.path.join('src', 'bind', sf) for sf in ['_isaac.cpp', 'core.cpp', 'driver.cpp', 'kernels.cpp', 'exceptions.cpp']]
|
||||
boostsrc = 'external/boost/libs/'
|
||||
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]
|
||||
|
@@ -70,15 +70,15 @@ namespace tools
|
||||
else
|
||||
name = bp::extract<std::string>(odtype.attr("__class__").attr("__name__"))();
|
||||
|
||||
if(name=="axpy") return sc::AXPY_TYPE;
|
||||
else if(name=="ger") return sc::GER_TYPE;
|
||||
if(name=="elementwise_1d") return sc::AXPY_TYPE;
|
||||
else if(name=="elementwise_2d") return sc::GER_TYPE;
|
||||
else if(name=="dot") return sc::DOT_TYPE;
|
||||
else if(name=="gemv_n") return sc::GEMV_N_TYPE;
|
||||
else if(name=="gemv_t") return sc::GEMV_T_TYPE;
|
||||
else if(name=="gemm_nn") return sc::GEMM_NN_TYPE;
|
||||
else if(name=="gemm_tn") return sc::GEMM_TN_TYPE;
|
||||
else if(name=="gemm_nt") return sc::GEMM_NT_TYPE;
|
||||
else if(name=="gemm_tt") return sc::GEMM_TT_TYPE;
|
||||
else if(name=="reduce_2d_rows") return sc::GEMV_N_TYPE;
|
||||
else if(name=="reduce_2d_cols") return sc::GEMV_T_TYPE;
|
||||
else if(name=="matrix_product_nn") return sc::GEMM_NN_TYPE;
|
||||
else if(name=="matrix_product_tn") return sc::GEMM_TN_TYPE;
|
||||
else if(name=="matrix_product_nt") return sc::GEMM_NT_TYPE;
|
||||
else if(name=="matrix_product_tt") return sc::GEMM_TT_TYPE;
|
||||
else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "Template type not understood");
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "isaac/kernels/templates/axpy.h"
|
||||
#include "isaac/kernels/templates/ger.h"
|
||||
#include "isaac/kernels/templates/elementwise_1d.h"
|
||||
#include "isaac/kernels/templates/elementwise_2d.h"
|
||||
#include "isaac/kernels/templates/dot.h"
|
||||
#include "isaac/kernels/templates/gemv.h"
|
||||
#include "isaac/kernels/templates/gemm.h"
|
||||
#include "isaac/kernels/templates/matrix_product.h"
|
||||
|
||||
#include "common.hpp"
|
||||
#include "kernels.h"
|
||||
@@ -56,17 +56,17 @@ void export_templates()
|
||||
#define WRAP_SINGLE_TEMPLATE(name, ...) WRAP_BASE(name) WRAP_TEMPLATE(name, name, __VA_ARGS__)
|
||||
|
||||
//Vector AXPY
|
||||
WRAP_SINGLE_TEMPLATE(axpy, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_SINGLE_TEMPLATE(ger, uint, uint, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_SINGLE_TEMPLATE(elementwise_1d, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_SINGLE_TEMPLATE(elementwise_2d, uint, uint, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_SINGLE_TEMPLATE(dot, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_BASE(gemv)
|
||||
WRAP_TEMPLATE(gemv_n, gemv, uint, uint, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_TEMPLATE(gemv_t, gemv, uint, uint, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_BASE(gemm)
|
||||
WRAP_TEMPLATE(gemm_nn, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
WRAP_TEMPLATE(gemm_tn, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
WRAP_TEMPLATE(gemm_nt, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
WRAP_TEMPLATE(gemm_tt, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
WRAP_TEMPLATE(reduce_2d_rows, gemv, uint, uint, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_TEMPLATE(reduce_2d_cols, gemv, uint, uint, uint, uint, uint, tpt::fetching_policy_type)
|
||||
WRAP_BASE(matrix_product)
|
||||
WRAP_TEMPLATE(matrix_product_nn, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
WRAP_TEMPLATE(matrix_product_tn, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
WRAP_TEMPLATE(matrix_product_nt, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
WRAP_TEMPLATE(matrix_product_tt, gemm, uint, uint, uint, uint, uint, uint, uint, uint, tpt::fetching_policy_type, tpt::fetching_policy_type, uint, uint)
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user