3220 views|3 replies

381

Posts

9

Resources
The OP
 

[Mil MYS-8MMX] Mil MYS-8MMQ6-8E2D-180-C Application 1 - Calculate pi [Copy link]

This post was last edited by tobot on 2021-8-11 10:33

We know that pi is an infinite non-repeating decimal (also called an irrational number). Sometimes we can use the time to calculate the value of pi to measure the quality of the CPU . Seeing that netizen @MianJi likes to compare this evaluation board with the Raspberry Pi 3B , I'd like to join in the fun. I have a ready-made Raspberry Pi 3B and 4B , but they are both 1G versions. Their performance may not be lower than that of the i.MX8M Mini , but the difference in memory may make them suffer a little in the evaluation results.

In the original ecosystem of Mil MYS-8MMQ6-8E2D-180-C , there are only python2 and python3 . Even the most commonly used gcc is not found. There is nothing like java , ruby , go , php ... However, there is bc in the shell , you can try it, then let's mainly use python for comparison.

Here are several calculation methods:

1. Power series expansion of inverse trigonometric functions

We know that π is a very special value in trigonometric functions , such as sin( π /2)=1 , tan( π /4)=1 , etc. Therefore, we can use the power series expansion of inverse sine or inverse tangent to calculate the value of pi .

For example,

In the inverse cotangent formula, let x = 1 , then arctan(x) = π /4 , expand and organize

Compilation Tools

Order

Cycle times

Raspberry Pi 3 B

Raspberry Pi 4 B (1G)

MYS-8MMX

shell

time bash trigonometric.sh

10000

bc

time bc -q trigonometric.bc

1 0000000

python2

time python 2 trigonometric.py

5 0000000

python3

time python 3 trigonometric.py

5 0000000

  1. Grid method

The distance from a point inside a circle to the center of the circle is less than the radius of the circle. So divide 1/4 of the circle into n*n grids, count how many grids fall inside the circle, divide it by the total number of grids, and multiply by 4 , and you can calculate the value of π.

Compilation Tools

Order

Cycle times

Raspberry Pi 3 B

Raspberry Pi 4 B (1G)

MYS-8MMX

shell

time bash grid.sh

10000

bc

time bc -q grid.bc

10000000

python2

time python 2 grid.py

5 0000000

python3

time python 3 grid.py

5 0000000

  1. Multiplication

Pi can be calculated using

.

Compilation Tools

Order

Cycle times

Raspberry Pi 3B

Raspberry Pi 4 B (1G)

MYS-8MMX

shell

time bash multipli.sh

10000

bc

time bc -q multipli.bc

5000000

python2

time python 2 multipli.py

50000000

python3

time python 3 multipli.py

50000000

  1. Monte Carlo method (random number method)

The method of estimating parameters using the results obtained through probability experiments is called the Monte Carlo method .

We can randomly pick a point in the square and the probability that it is in its inscribed circle is π /4 . We can use this to calculate pi.

Compilation Tools

Order

Cycle times

Raspberry Pi 3B

Raspberry Pi 4 B (1G)

MYS-8MMX

shell

time bash rand.sh

1000000

python2

time python 2 rand.py

50000000

python3

time python 3 rand.py

50000000

Judging from the above results, the performance of NXP 's i.MX8M Mini is slightly lower than Broadcom BCM2711 , but higher than Broadcom BCM2837 .

Why does memory overflow occur?

This post is from Embedded System

Latest reply

The performance of i.MX8M Mini is slightly lower than Broadcom BCM2711 and higher than Broadcom BCM2837  Details Published on 2021-8-15 08:13

381

Posts

9

Resources
2
 

Source code, share it!

pi-used.rar (2.49 KB, downloads: 0)

This post is from Embedded System
 
 

7422

Posts

2

Resources
3
 

This is quite interesting. It seems that the numerical calculation of imx8 is still a bit weak. After all, it came out a few years later.

This post is from Embedded System
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

104

Posts

0

Resources
4
 
The performance of i.MX8M Mini is slightly lower than Broadcom BCM2711 and higher than Broadcom BCM2837
This post is from Embedded System
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list