Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p4 compile attempting to run parallel docker compile #442

Closed
vincent-xs opened this issue Sep 21, 2023 · 5 comments
Closed

p4 compile attempting to run parallel docker compile #442

vincent-xs opened this issue Sep 21, 2023 · 5 comments

Comments

@vincent-xs
Copy link
Contributor

@chrispsommers @kcudnik

just picking up the new DASH repo and compiling the p4 on an 80core machine (make -j).
I am getting an error now due to 2 docker run to compile the P4 are run as seen below.

I believe this is due the makefile change related to the p4 rule which depends now on 2 files (that's fine).
the issue is the rule for the files (so each of them technically) is the docker run.
so make -j will launch 2 of those to get both the json and prt file to be compiled.

IMO, a quick change is: json should depend on p4rt.txt, and the p4 artifact rule should be changed to be the p4rt file rule.

P4_ARTIFACTS=$(P4_OUTDIR)/dash_pipeline.json $(P4_OUTDIR)/dash_pipeline_p4rt.txt

p4: $(P4_ARTIFACTS)

.PHONY:p4-clean
p4-clean:
rm -rf $(P4_OUTDIR)

Compile P4 into bmv2 .json fle and P4info for SAI header autogeneration

$(P4_ARTIFACTS): $(P4_SRC)
@echo "Compile P4 program $(P4_MAIN) for bmv2 ..."
mkdir -p $(P4_OUTDIR)
docker run
--rm
--name dash-p4c-$(USER)
-u $(HOST_USER):$(HOST_GROUP)
$(DOCKER_FLAGS)
-v $(PWD)/bmv2:/bmv2
-w /
$(DOCKER_P4C_BMV2_IMG) p4c
-DTARGET_BMV2_V1MODEL
$(P4_MAIN)
-b bmv2
-o $(P4_OUTDIR)
--p4runtime-files $(P4_OUTDIR)/dash_pipeline_p4rt.json,$(P4_OUTDIR)/dash_pipeline_p4rt.txt

DOCKER_FLAGS= make -C /nobackup/vincentl/dash_ha_test/submodules/DASH/dash-pipeline p4
make[4]: Entering directory '/nobackup/vincentl/dash_ha_test/submodules/DASH/dash-pipeline'
Compile P4 program bmv2/dash_pipeline.p4 for bmv2 ...
mkdir -p bmv2/dash_pipeline.bmv2
Compile P4 program bmv2/dash_pipeline.p4 for bmv2 ...
mkdir -p bmv2/dash_pipeline.bmv2
docker run
--rm
--name dash-p4c-vincentl
-u 1024:1024

-v /nobackup/vincentl/dash_ha_test/submodules/DASH/dash-pipeline/bmv2:/bmv2
-w /
sonicdash.azurecr.io/dash-p4c-bmv2:40c82fd0c19 p4c
-DTARGET_BMV2_V1MODEL
bmv2/dash_pipeline.p4
-b bmv2
-o bmv2/dash_pipeline.bmv2
--p4runtime-files bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.json,bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.txt
docker run
--rm
--name dash-p4c-vincentl
-u 1024:1024

-v /nobackup/vincentl/dash_ha_test/submodules/DASH/dash-pipeline/bmv2:/bmv2
-w /
sonicdash.azurecr.io/dash-p4c-bmv2:40c82fd0c19 p4c
-DTARGET_BMV2_V1MODEL
bmv2/dash_pipeline.p4
-b bmv2
-o bmv2/dash_pipeline.bmv2
--p4runtime-files bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.json,bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.txt
docker: Error response from daemon: Conflict. The container name "/dash-p4c-vincentl" is already in use by container "46fae869d3deabec9d17bd54f7d6b141102c5f1a5ccde6997c5e4eff8953c8ba". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
make[4]: *** [Makefile:113: bmv2/dash_pipeline.bmv2/dash_pipeline_p4rt.txt] Error 125
make[4]: *** Waiting for unfinished jobs....

@chrispsommers
Copy link
Collaborator

@vincent-xs Thank for reporting this. Since you have an environment which reproduces this, and a proposed fix, would you mind doing a PR to resolve it?

@vincent-xs
Copy link
Contributor Author

@chrispsommers

will do.

@vincent-xs
Copy link
Contributor Author

#443

@kcudnik
Copy link
Collaborator

kcudnik commented Sep 22, 2023

thanks, i was testing this in single thread environment, anyway, after my changes it should be much faster to compile anyway :)

@vincent-xs
Copy link
Contributor Author

vincent-xs commented Sep 22, 2023

Kamil, please test the compile in multi core env (DOCKER_FLAGS= make -j <>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants