Skip to content

Commit eb284b9

Browse files
committed
profiling
1 parent bb8dd24 commit eb284b9

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ test_opencl: ${TEST_OPENCL}
4343

4444
#objs := $(wildcard ${BUILD}/obj/*.o)
4545
%_riscv: ${TESTS}/%.cc lib
46-
riscv64-unknown-linux-gnu-g++ -o ${BUILD}/${TESTS}/$@ $< -DDEVICE=2 -std=c++11 -I${INCLUDE} -L${BUILD} -pthread -lcvm -fsigned-char -Wl,-rpath=${BUILD}
46+
riscv64-unknown-linux-gnu-g++ -o ${BUILD}/${TESTS}/$@ $< -DDEVICE=0 -std=c++11 -I${INCLUDE} -L${BUILD} -pthread -lcvm -fsigned-char -Wl,-rpath=${BUILD}
4747
clean:
4848
rm -rf ./build/*

src/runtime/graph_runtime.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
//#define CUDA_PROFILE
2525

2626
#ifdef PROFILE
27-
#include <omp.h>
27+
#include <time.h>
2828
#ifdef CUDA_PROFILE
2929
#include <cuda.h>
3030
#include <cuda_runtime.h>
@@ -59,7 +59,7 @@ CVM_REGISTER_OP(cvm_op)
5959
*/
6060
void CvmRuntime::Run() {
6161
#ifdef PROFILE
62-
double start = omp_get_wtime();
62+
clock_t start = clock();
6363
#endif
6464
// setup the array and requirements.
6565
for (size_t i = 0; i < op_execs_.size(); ++i) {
@@ -69,8 +69,8 @@ void CvmRuntime::Run() {
6969
#ifdef CUDA_PROFILE
7070
cudaDeviceSynchronize();
7171
#endif
72-
double end = omp_get_wtime();
73-
double total = end - start;
72+
clock_t end = clock();
73+
double total = (double)(end - start) / CLOCKS_PER_SEC;
7474
std::vector<std::pair<std::string, double>> vec_times(times.begin(), times.end());
7575
std::stable_sort(vec_times.begin(), vec_times.end(),
7676
[](const std::pair<std::string, double>& a, const std::pair<std::string, double>& b) ->bool {
@@ -662,7 +662,7 @@ std::function<void()> CvmRuntime::CreateCVMOp(
662662
](){
663663
#ifdef PROFILE
664664
if(times.find(op) == times.end()) times[op] = 0;
665-
double start = omp_get_wtime();
665+
clock_t start = clock();
666666
#endif
667667
CVMRetValue rv;
668668
CVMArgs targs(
@@ -677,8 +677,8 @@ std::function<void()> CvmRuntime::CreateCVMOp(
677677
#ifdef CUDA_PROFILE
678678
//cudaDeviceSynchronize();
679679
#endif
680-
double end = omp_get_wtime();
681-
times[op] += end-start;
680+
clock_t end = clock();
681+
times[op] += (double)(end-start) / CLOCKS_PER_SEC;
682682
#endif
683683
};
684684

tests/test_model.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,13 @@ void test_thread() {
252252
int test_models(int device_type = 0) {
253253
std::cout << device_type << " DDDDDD" << std::endl;
254254
auto model_roots = {
255-
"/data/std_out/cvm_mnist"
255+
// "/data/std_out/cvm_mnist"
256256
// "/data/std_out/yolo_tfm",
257257
// "/data/std_out/null",
258258
// "/data/std_out/resnet50_mxg",
259259
// "/data/std_out/ssd_512_mobilenet1.0_voc_tfm",
260260
// "/data/std_out/resnet18_v1_tfm",
261-
// "/data/std_out/resnet50_v2",
261+
"/data/std_out/resnet50_v2",
262262
// "/data/std_out/qd10_resnet20_v2",
263263
// "/data/std_out/trec",
264264
// // "/data/new_cvm/yolo3_darknet53_voc/data",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy