Skip to content

[bug] fix popsift static release#807

Merged
fabiencastan merged 8 commits intodevelopfrom
fix/popsiftExtractor
Jun 16, 2020
Merged

[bug] fix popsift static release#807
fabiencastan merged 8 commits intodevelopfrom
fix/popsiftExtractor

Conversation

@simogasp
Copy link
Copy Markdown
Member

@simogasp simogasp commented Jun 9, 2020

Since alicevision/popsift/pull/71, popsift is now always releasing the resources with the destructor.

In our implementation of ImageDescriber_SIFT_popSIFT popsift is a static member of the class to avoid multiple instances of the Cuda run-time.
Since static object are destroyed last, it happens in alicevision_extractFeatures that the popsift destructor tries to release resource when the Cuda runtime is already shut down.
This causes an error on exit from the program:

~/dev/alicevision/sandbox/popsift/src/popsift/s_image.cu:259
    Could not destroy texture object: driver shutting down

In order to fix the problem, a static counter in the class ImageDescriber_SIFT_popSIFT has been added to count how many instances of the class there are and when the last one is destroyed, also the static popsift is destroyed (the old good "the last one shut the door" principle :-) )

This is a mitigating solution in that it is efficient in managing multiple instances of ImageDescriber_SIFT_popSIFT running at the same time, but obviously it has the drawback that it introduces overheads for allocating/deallocating cuda stuff when several ImageDescriber_SIFT_popSIFT instances are created and destroyed in sequence.

In alicevision ImageDescriber_SIFT_popSIFT at the moment is only used with a single instance so there are no issues.

Incidentally, it cleans up a little the constructors/destructors of the other feature classes with missing explicit, default and override. Sorry, the OCD kicked in. :-)

@simogasp simogasp added the bugfix label Jun 9, 2020
@simogasp simogasp added this to the 2020.1.0 milestone Jun 9, 2020
@simogasp simogasp requested review from fabiencastan and griwodz June 9, 2020 21:33
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

Successfully merging this pull request may close these issues.

2 participants