[Rpm-maint] [rpm-software-management/rpm] how to use the multi-threaded mode for packaging rpm? (#970)

ThreeDog notifications at github.com
Wed Dec 11 07:09:20 UTC 2019


@pmatilai  @ignatenkobrain 
Thanks for your explanation, I’ve tried by myself, but follow-up problem emerges: 
I found the code in the source code:
```c
rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
{
    rpmRC rc = RPMRC_OK;
    Package pkg;

    /* Run binary creation in parallel */
    #pragma omp parallel
    #pragma omp single
    for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
	#pragma omp task
	{
	pkg->rc = packageBinary(spec, pkg, cookie, cheating, &pkg->filename);
	rpmlog(RPMLOG_DEBUG,
		_("Finished binary package job, result %d, filename %s\n"),
		pkg->rc, pkg->filename);
	if (pkg->rc) {
	    #pragma omp critical
	    rc = pkg->rc;
	}
	} /* omp task */
	if (rc)
	    break;
    }

    /* Now check the package set if enabled */
    if (rc == RPMRC_OK)
	checkPackageSet(spec->packages);

    return rc;
}
```
I found that the multithreaded execution depends on the number of times the for loop is executed. Each for loop is put into a separate thread for execution. If the loop is more than 12 times, there are at most 12 threads running at the same time.

But when I debugged my packaging process, I found that this for loop was only executed once, which directly led to my program can not be multi-threaded packaging.

I want to know what the PKG in this for loop means. Can I divide my content to be packaged into several more packages with a small amount of changes so that it can be multi-threaded packaged?
 
This problem has puzzled me for quite a long time, so I sincerely hope that you can take a few minutes to read my comments, some details are presented in my last comment. 
That would be appreciated if you can help me out. Look forward to your reply!


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/970#issuecomment-564410136
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20191210/425ad4c7/attachment.html>


More information about the Rpm-maint mailing list