LOCAL_ARM_NEON := true
LOCAL_CFLAGS += -pthread -fopenmp -fexceptions
LOCAL_CXXFLAGS += -std=c++11 -frtti -fexceptions
-LOCAL_LDFLAGS += -fuse-ld=bfd
+LOCAL_LDFLAGS += -fuse-ld=bfd -fopenmp
LOCAL_MODULE_TAGS := optional
LOCAL_LDLIBS := -llog
nntrainer_conf.set('LIB_INSTALL_DIR', nntrainer_libdir)
nntrainer_conf.set('INCLUDE_INSTALL_DIR', nntrainer_includedir)
+dummy_dep = dependency('', required: false)
+openmp_dep = dependency('openmp')
+
+blas_dep = dummy_dep
# Dependencies
if get_option('enable-blas')
add_project_arguments('-DUSE_BLAS=1', language:['c','cpp'])
#else
unsigned int i;
for (k = 0; k < dim.batch(); ++k) {
-
unsigned int id = k * dim.getFeatureLen();
- ret.data[id] = 0.0;
+ ret.data[k] = 0.0;
for (i = 0; i < dim.getFeatureLen(); ++i) {
- ret.data[id] += data[id + i];
+ ret.data[k] += data[id + i];
}
}
#endif
#ifdef USE_BLAS
cblas_scopy(dim.getDataLen(), from.data.data(), 1, this->data.data(), 1);
#else
- for (int i = 0; i < dim.getDataLen(); ++i)
+ for (unsigned int i = 0; i < dim.getDataLen(); ++i)
data[i] = from.data[i];
#endif
}
float tmp;
unsigned int len = dim.getDataLen();
+ #pragma omp parallel for private(tmp) reduction(+:sum)
for (unsigned int i = 0; i < len; i++) {
- tmp = this->data[i];
+ tmp = data[i];
sum += tmp * tmp;
}