Skip to content

Commit 37e9a75

Browse files
committed
using qemu-system to create virtual mips system, simulate mips pcs in x86
1 parent 7a425e2 commit 37e9a75

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

tests/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ CVM-Runtime Test_Model
4343
After running 2 Architectures, the result file can be compared.
4444

4545
- static run: `LD_LIBRARY_PATH="/path_to_libcvm_runtime_library":${LD_LIBRARY_PATH} qemu-mips-static ./test_model_arch0`
46+
47+
48+
# To execute under dynamic library (so: shared library)
49+
- using mips32 big endian
50+
- debian-mips-qemu, install img and start kernel. has ld.so.1 (single core mips cpu)
51+
- scp -R cvm-runtime -P 2222 debian@127.0.0.1:/home/debian
52+
- ssh -p 2222 debian@127.0.0.1 # with password debian
53+
- build libso, build test_model, and execute binary.

tests/test_model.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ void read_data(const char *filename, vector<unsigned long> &shape, vector<int32_
3333
fscanf(fp, "%d ", &shape_dim);
3434
printf("shape_dim = %d\n", shape_dim);
3535
shape.resize(shape_dim);
36-
uint64_t size = 1;
36+
uint32_t size = 1;
3737
for(int i = 0; i < shape_dim; i++){
38-
int64_t value = 0;
38+
int32_t value = 0;
3939
fscanf(fp, "%ld ", &value);
4040
shape[i] = value;
4141
size *= shape[i];
@@ -88,7 +88,7 @@ struct OpArgs {
8888
std::vector<DLTensor> args;
8989
std::vector<CVMValue> arg_values;
9090
std::vector<int> arg_tcodes;
91-
std::vector<int64_t> shape_data;
91+
std::vector<int32_t> shape_data;
9292
};
9393

9494
int run_LIF(string model_root, int device_type = 0) {
@@ -181,11 +181,11 @@ int run_LIF(string model_root, int device_type = 0) {
181181
CHECK_STATUS(status, "free model failed");
182182

183183
if (json_path.find("yolo") != string::npos || json_path.find("ssd") != string::npos) {
184-
uint64_t n_bytes = 4;
185-
uint64_t ns = output.size() / n_bytes;
184+
uint32_t n_bytes = 4;
185+
uint32_t ns = output.size() / n_bytes;
186186
std::cout << "yolo output size = " << ns << " n_bytes = " << n_bytes << "\n";
187187
int32_t* int32_output = static_cast<int32_t*>((void*)output.data());
188-
for (auto i = 0; i < std::min<uint64_t>(60UL, ns); i++) {
188+
for (auto i = 0; i < std::min<uint32_t>(60UL, ns); i++) {
189189
std::cout << (int32_t)int32_output[i] << " ";
190190
if ((i + 1) % 6 == 0)
191191
std::cout << "\n";
@@ -201,7 +201,7 @@ int run_LIF(string model_root, int device_type = 0) {
201201
std::cout << "\n";
202202
} else {
203203
std::cout << "output size = " << output.size() << "\n";
204-
for (auto i = 0; i < std::min<uint64_t>(6UL * 10, output.size()); i++) {
204+
for (auto i = 0; i < std::min<uint32_t>(6UL * 10, output.size()); i++) {
205205
std::cout << (int32_t)output[i] << " ";
206206
}
207207
std::cout << "\n";

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