Closed MicheleCancilla closed 3 years ago
Thanks Michele, I'm going to solve it asap.
Dear Michele,
I just pushed a commit into develop facing what you commented, but I have no the chance to test it in Windows, could you check it? I'm ready to fix any bug derived from this commit.
Regads,
Jon
Dear Jon,
the tests do not pass on windows, but I understand why. The TensorTestSuite.tensor_math_unary_log
test fails throwing exception in eddl_malloc
.
I have verified that errno != 0
is true before calling _aligned_malloc and errno value is 33 (EDOM Math argument).
auto err_ = errno;
ptr = _aligned_malloc(size, alignment_block_size);
error = (nullptr == ptr || errno != 0);
err_ = errno;
I suggest only checking if allocation fails (doc):
ptr = _aligned_malloc(size, alignment_block_size);
error = (nullptr == ptr || errno == ENOMEM);
I get a different compilation error (a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
) on _5_nlp_textgeneration. You should remove parentheses around vtensor
:
forward(decoder, vtensor{ word,treshape,state });
For everybody: errno
should be set to 0 before calling a function, if you plan to check its value. errno
should be checked only in case of error in function.
Check this: https://softwareengineering.stackexchange.com/a/209731/360023
Thanks for the comment Costantino. And thanks for the suggestion Michele.
Let me solve it and I will push a commit.
Jon
Hi again,
Commit following your indications pushed, also the compiling problem with the call to forward in the NLP example fixed.
Michele, could you please check in windows if both problems are solved?
Regards,
Jon
No, it does not work 😂
There is an error in the errno condition error = (nullptr == ptr || errno != ENOMEM);
.
It should be error = (nullptr == ptr || errno == ENOMEM);
.
Sorry, my logic fails. I need a windows instance to do checks and avoid bothering you with this. Please, check it after the last commit and close the issue if finally it runs. Regards, Jon
Yes, it works! Thank you Jon.
I was looking for windows incompatibilites in develop branch and I spotted some issues regarding the
get_fmem()
function that could be solved.-
The
get_free_mem()
function returns anunsigned long
which could cause integer overflow. I would move return type tounsigned long long
.posix_memalign()
is not available on windows._aligned_malloc()
could be a windows replacement but requires a specific function for freeing memory (_aligned_free()
) instead offree()
. Two feasible choices are:eddl_malloc()
andeddl_free()
which contain call to posix_memalign/_aligned_malloc (and free/_aligned_free).malloc()
under windows loosing the alignment feature.The try/catch is now useless since
posix_memalign()
does not throw any exceptions, but it returns an error code.I can open a PR so you can test the changes.