Comments (11)
Add this function to show memory information.
`static void display_mallinfo(void)
{
struct mallinfo mi = mallinfo();
printf("Total non-mmapped bytes (arena): %d\n", mi.arena);
printf("of free chunks (ordblks): %d\n", mi.ordblks);
printf("of free fastbin blocks (smblks): %d\n", mi.smblks);
printf("of mapped regions (hblks): %d\n", mi.hblks);
printf("Bytes in mapped regions (hblkhd): %d\n", mi.hblkhd);
printf("Max. total allocated space (usmblks): %d\n", mi.usmblks);
printf("Free bytes held in fastbins (fsmblks): %d\n", mi.fsmblks);
printf("Total allocated space (uordblks): %d\n", mi.uordblks);
printf("Total free space (fordblks): %d\n", mi.fordblks);
printf("Topmost releasable block (keepcost): %d\n", mi.keepcost);
}`
============== Before alloc context ==============
Total non-mmapped bytes (arena): 138816
of free chunks (ordblks): 1
of free fastbin blocks (smblks): 0
of mapped regions (hblks): 0
Bytes in mapped regions (hblkhd): 0
Max. total allocated space (usmblks): 0
Free bytes held in fastbins (fsmblks): 0
Total allocated space (uordblks): 3536
Total free space (fordblks): 135280
Topmost releasable block (keepcost): 135280
============== After alloc context ==============
Total non-mmapped bytes (arena): 286272
of free chunks (ordblks): 1
of free fastbin blocks (smblks): 0
of mapped regions (hblks): 0
Bytes in mapped regions (hblkhd): 0
Max. total allocated space (usmblks): 0
Free bytes held in fastbins (fsmblks): 0
Total allocated space (uordblks): 232736
Total free space (fordblks): 53536
Topmost releasable block (keepcost): 53536
============== Befor onnx run ==============
Total non-mmapped bytes (arena): 286272
of free chunks (ordblks): 1
of free fastbin blocks (smblks): 0
of mapped regions (hblks): 0
Bytes in mapped regions (hblkhd): 0
Max. total allocated space (usmblks): 0
Free bytes held in fastbins (fsmblks): 0
Total allocated space (uordblks): 232736
Total free space (fordblks): 53536
Topmost releasable block (keepcost): 53536
============== After onnx run ==============
Total non-mmapped bytes (arena): 450112
of free chunks (ordblks): 3
of free fastbin blocks (smblks): 0
of mapped regions (hblks): 0
Bytes in mapped regions (hblkhd): 0
Max. total allocated space (usmblks): 0
Free bytes held in fastbins (fsmblks): 0
Total allocated space (uordblks): 235552
Total free space (fordblks): 214560
Topmost releasable block (keepcost): 133728
2MB memory is enough. mnist is the smallest model, you can usinig xxd -i for other models.
from libonnx.
Thanks.
Unfortunately I'm not running on Linux.
It's a cortex-a7 with ThreadX and debugging is very limited (no JTAG).
I'm unable to run much at the moment as it fails and I can trace it easily.
from libonnx.
Hi,
I traced the fault down to memalign. I had to add my own implementation as I have done for malloc ,free and realloc.
It run the benchmark but freeing some objects isn't performed well, probably due to memalign.
Thanks!
from libonnx.
just using malloc instead of memalign,512 bytes align is not necessary.
from libonnx.
So leaving it as align 4 and allocating the len shall be sufficient?
from libonnx.
It worked ;)
from libonnx.
Must ensure 8-byte alignment, double type。for 32-bits system, malloc usually 8-byte aligned, for 64-bits system, usually 16-byte aligned, the twice of void * type, Confirm your malloc alignment。
from libonnx.
I have added this:
UCHAR mem_heap[MALLOC_BYTE_POOL_SIZE] attribute ((aligned (8)));
from libonnx.
write customized malloc may be ok. 8-bytes align for onnx_tensor_t's datas.
from libonnx.
It seems to work. Im also able to run the mnist model.
Just the debug output isnt quite right. Need to figure out the printf implementation.
from libonnx.
I just need to append LF on every CR as I'm on windows.
So far so good.
Thanks for your help. The library is great!
from libonnx.
Related Issues (20)
- 可以参考下ONNC怎么做的
- Tensorflow model with opset 12 seems to crash when loaded HOT 5
- Question: Does libonnx support dynamic shape/CUDA ? HOT 4
- Which header files are necessary? HOT 2
- Why does every test in the model, node and simple folders fail? HOT 2
- How to convert a `onnx_context` to a `unsigned char array` as in the hello world example? HOT 3
- Failed to load 'yolov5n.onnx'. HOT 2
- Maxpool + dilation
- Inference on GPU HOT 4
- Support GRU? HOT 1
- Valgrind output for Yolo v2 model HOT 1
- Unsupported opset => Gather-11 (ai.onnx) HOT 2
- Python bindings HOT 9
- Support ORT (flatbuffers) models
- Should Conv nodes be optimized using FFT?
- Implement Fourier transform nodes
- Evaluate if it makes sense to utilize NNPack
- 请问在哪里看opset_version和对应版本所支持的算子列表?
- compile failed , report the error which macro undefined HOT 1
- Fail to compile on macOs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libonnx.