black-parrot / black-parrot-sim

BSD 3-Clause "New" or "Revised" License
12 stars 7 forks source link

Unit test clarification #20

Open garyz712 opened 5 months ago

garyz712 commented 5 months ago

Hi we are a research team from Harvard and we are trying to figure out what exactly each provided test is testing in the black parrot simulation environment (https://github.com/black-parrot/black-parrot-sim). For example, make -C black-parrot/bp_top/syn tire_kick and make -C black-parrot/bp_top/syn build.sc sim.sc COSIM_P=1 We understand that the tests above are made of many lower level unit tests. Could anyone provide some insight on what exact unit tests are included in each test case provided in a lower level? What are some other low level unit test that we can do to make sure every little piece is working well? We really appreciate that! Thanks!

dpetrisko commented 5 months ago

Hi, thanks for your interest in the project. That command runs a single test, which is by default hello world (SUITE=bp-tests PROG=hello_world).

Running different tests is covered here in the eval guide: https://github.com/black-parrot/black-parrot/blob/master/docs/eval_guide.md#example-commands

The guide also explains how to run a testlist (run_testlist.vcs), which contain many unit tests and can be run in parallel

garyz712 commented 5 months ago

Hi, thanks for your interest in the project. That command runs a single test, which is by default hello world (SUITE=bp-tests PROG=hello_world).

Running different tests is covered here in the eval guide: https://github.com/black-parrot/black-parrot/blob/master/docs/eval_guide.md#example-commands

The guide also explains how to run a testlist (run_testlist.vcs), which contain many unit tests and can be run in parallel

Hi! Thanks for your quick reply! I believe those tests (especially make run_testlist.sc -j 10 TESTLIST=BEEBS_TESTLIST ) in evaluation guide are only applicable after running make prep, but I only run make prep_lite to save time. Are there other unit tests I can do after running make prep_lite? Thank you!!!

dpetrisko commented 5 months ago

prog_lite (prep_lite) builds a subset of tests just to smoke test the environment. For any serious verification, I'd recommend building the rest of the free suites (riscv-tests, coremark, beebs)

https://github.com/black-parrot-sdk/black-parrot-sdk/blob/fe3852e0188d2edcc1884368534ef0e839027276/Makefile#L56

garyz712 commented 5 months ago

prog_lite (prep_lite) builds a subset of tests just to smoke test the environment. For any serious verification, I'd recommend building the rest of the free suites (riscv-tests, coremark, beebs)

https://github.com/black-parrot-sdk/black-parrot-sdk/blob/fe3852e0188d2edcc1884368534ef0e839027276/Makefile#L56

I am running make prep inside the docker to install all necessary testing package, but it is giving me the error below in the screenshot. I don’t see errors when I was running make prep_lite. Do you know how to fix this? Should I clean and rebuild black parrot sdk? Thank you!

IMG_6380

dpetrisko commented 5 months ago

Which docker image are you using, centos or Ubuntu? I'll take a look, those should work out of box

garyz712 commented 5 months ago

Which docker image are you using, centos or Ubuntu? I'll take a look, those should work out of box

Ubuntu I believe, I just followed the commands below and then run make prep inside black-parrot-sim. Am I missing any important steps?

Docker build

For a painless Ubuntu build, download and install Docker Desktop then run the following:

git clone https://github.com/black-parrot/black-parrot-sim.git cd black-parrot-sim make -C docker docker-image docker-run make prep

garyz712 commented 5 months ago

I clean everything and rerun the make prep, but the same issue remains. I am using a MacBook, is this going to work for Mac OS inside the docker?

dpetrisko commented 5 months ago

Hi, I just cloned anew, worked all the way through "make prep" for me. The default docker image is centos7, built and ran from scratch.

My docker version is: Docker version 20.10.17, build 100c701

You might want to update if you're much older than that.

going to work for Mac OS inside the docker

If it is an M1/M2 macbook, it could be a rosetta issue running an x86 image on an ARM64 processor. Unfortunately, that's way beyond my debugging scope. I'd suggest running in an x86 VM instead, which I understand have better emulation capabilities.

dpetrisko commented 5 months ago

I also found this, could be some help: https://akintola-lonlon.medium.com/your-mac-m-1-docker-image-is-not-going-to-work-on-production-heres-why-f8175bc33d90

This snippet is interesting:

docker buildx build --platform linux/amd64 \
    -t <your-dockerhub-username>/<your-image-name> \
    -f Dockerfile \
    --push \
    --no-cache \

"--platform linux/amd64" could be helpful

garyz712 commented 5 months ago

Thank you for your reply! I am using an old MacBook (not M1/2), with Docker version 26.1.1, build 4cf5afa. I think they should work,. Probably I just missed some steps. Btw, make prep_lite works for me Let me recap all that I have done below: """ git clone https://github.com/black-parrot/black-parrot-sim.git cd black-parrot-sim pip install --user orderedmultidict make -C docker docker-image docker-run make prep """ is it because I did not install dependencies and update cmake for CentOS7+? But I couldn't do so inside the docker since I can't use sudo or apt-get in my docker container.

dpetrisko commented 5 months ago

The idea of a docker image is to work out of box, with no additional dependencies. (You do not need to pip install anything). You can see the docker image doing everything in the getting started guide here: https://github.com/black-parrot/black-parrot-sim/blob/9cced2329790853e4f18fdbcb823cff72f3a0c03/docker/Dockerfile.centos7#L25.

I would try in order 1) Switching to the ubuntu docker image 2) Running a Centos7 VM

It's possible the MacOS kernel itself incompatible with parts of the build process, in which case a VM is the only practical way to fix it

garyz712 commented 5 months ago

Thanks for your explanation! It is surprising that CentOS image isn’t compatible with macOS. How to switch to Ubuntu docker Image on MacBook?

Is there any other developers using macOS before able to build it?