Bug 268779

Summary: graphics/openpgl: fix build with OpenMP (-TBB)
Product: Ports & Packages Reporter: Matthieu Volat <mazhe>
Component: Individual Port(s)Assignee: Robert Clausecker <fuz>
Status: Closed FIXED    
Severity: Affects Some People CC: FreeBSD, fuz
Priority: --- Flags: bugzilla: maintainer-feedback? (FreeBSD)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch for the port directory.
none
poudriere build log file.
none
remove TBB as an option FreeBSD: maintainer-approval+

Description Matthieu Volat 2023-01-06 07:53:24 UTC
Created attachment 239297 [details]
Patch for the port directory.

Hi,

I have been issues building graphics/openpgl with the OpenMP multithreading backend rather than TBB. It's not much :

- In openpgl/spatial/kdtree/KDTreeBuilder.h, updateTreeNode() calls are missing their sample argument in OpenMP version (not in TBB), just add it

- In openpgl/spatial/KNN.h, a #pragma parallel for try to set the number of cores from an inexistant variable, the TBB version do not set the number of cores: remove the parameters.

The patches are in #ifdef-ed parts of the code and can be applied regardless of the option selected. I will aslo add a poudriere build log for QA.

Thanks,
Comment 1 Matthieu Volat 2023-01-06 07:54:36 UTC
Created attachment 239298 [details]
poudriere build log file.
Comment 2 Shane 2023-01-09 23:50:42 UTC
Created attachment 239368 [details]
remove TBB as an option

I don't think the choice between omp and tbb is a working option.

While your patch fixes the compile, it still requires tbb installed to use `tbb::concurrent_vector` and the built lib still links against `libtbb` and not `libomp`

So for now I would suggest removing tbb as an option until this is resolved
Comment 3 Matthieu Volat 2023-01-20 14:49:21 UTC
Indeed, you are right. I did not notice that before that graphics/embree still had TBB and was bringing it back... And the code is littered with other uses of TBB.

That is starting to look like to much work and I'm not sure upstream would show interest in fixing non-OneAPI stuff, better drop the option altogether.
Comment 4 Robert Clausecker freebsd_committer freebsd_triage 2023-02-24 15:50:58 UTC
Will commit attachment #239368 [details] with my next batch.
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-02-27 22:50:17 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ea58be71e246b295cbc02ffaf424cee3db39196b

commit ea58be71e246b295cbc02ffaf424cee3db39196b
Author:     Shane <FreeBSD@ShaneWare.Biz>
AuthorDate: 2023-02-24 15:56:01 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-02-27 22:47:36 +0000

    graphics/openpgl: remove TBB option

    Disabling the TBB option didn't work and does not appear to be
    immediately fixable.  Remove the option as a workaround until
    a solution obtains.

    PR:             268779
    Reported by:    Matthieu Volat <mazhe@alkumuna.eu>
    Approved by:    flo (mentor)
    Differential Revision: https://reviews.freebsd.org/D38777

 graphics/openpgl/Makefile | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
Comment 6 Robert Clausecker freebsd_committer freebsd_triage 2023-02-27 22:52:47 UTC
Thank you for your contribution.