parfor with C++ function call and memory allocation

8 vues (au cours des 30 derniers jours)
Oscar Roberto BLANCO-GARCIA
Commenté : Mike Croucher le 8 Avr 2022
Dear all,
I have a function written in C++ that allocates memory depending on the size of the input.
This function was compiled with mex and call from matlab inside a for loop.
When running a large number of iterations the C++ function returns Nan values because of memory corruption.
For a small number of iterations, it just seems to run in separate processors and finish without changing to Nan values.
Are there any recomendations about how to write C++ functions with memory allocation compatible with parfor ?
Best regards,
o
  1 commentaire
Mike Croucher
Mike Croucher le 8 Avr 2022
Is it possible to share the code and provide a demo of it going wrong please?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Call C++ from MATLAB dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by