I am working on hardware implemetation of MPC - from your suggestion to another post - I am able to remove all instances of calloc. but there are few more instances of malloc - Realvec = (typeRNum)malloc(size * sizeof(typeRNum));
how to remove that - I dont have option of dynamic memory allocation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
as far as I can see, the two functions CastDvec2Intvec and CastDvec2Numvec are not used within the C code (relevant folders are grampc/src and grampc/include). These functions are used in the Matlab interface and should therefore better be placed somewhere in grampc/matlab/src. For a hardware implementation, I would suggest to simply remove or comment these two functions.
Regards,
Andreas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
please see my comment in https://sourceforge.net/p/grampc/discussion/general/thread/73178797f2/. If you have some replacement for calloc on your hardware, there are very few instances of calloc that you have to replace. Otherwise, things are more involved. Basically, you have to fix some parameters of your problem (Nx, Nu, Np, Nhor, MaxGradIter, MaxMultIter), then you can replace all dynamically allocated arrays by fixed-size arrays. In the current version of GRAMPC, there is no support for generating this automatically, so you have to modify the code yourself.
Regards,
Andreas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
for your information, the new version 2.2 of GRAMPC supports compilation without dynamic memory allocation, i.e. without any calls to malloc, calloc or realloc. Please have a look at Section 5.1.5 of the updated documentation, where this new functionality is explained.
Regards,
Andreas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am working on hardware implemetation of MPC - from your suggestion to another post - I am able to remove all instances of calloc. but there are few more instances of malloc -
Realvec = (typeRNum)malloc(size * sizeof(typeRNum));
how to remove that - I dont have option of dynamic memory allocation.
Hello Vaishali,
as far as I can see, the two functions CastDvec2Intvec and CastDvec2Numvec are not used within the C code (relevant folders are grampc/src and grampc/include). These functions are used in the Matlab interface and should therefore better be placed somewhere in grampc/matlab/src. For a hardware implementation, I would suggest to simply remove or comment these two functions.
Regards,
Andreas
Thanks Andreas
will check the same.
Also from file grampc_util.c
cs = (typeInt )calloc(size, sizeof(typeInt))
is creating variable soze array - is there any option for this?
thanks in advance
Hello Vaishale,
please see my comment in https://sourceforge.net/p/grampc/discussion/general/thread/73178797f2/. If you have some replacement for calloc on your hardware, there are very few instances of calloc that you have to replace. Otherwise, things are more involved. Basically, you have to fix some parameters of your problem (Nx, Nu, Np, Nhor, MaxGradIter, MaxMultIter), then you can replace all dynamically allocated arrays by fixed-size arrays. In the current version of GRAMPC, there is no support for generating this automatically, so you have to modify the code yourself.
Regards,
Andreas
Hello Vaishale,
for your information, the new version 2.2 of GRAMPC supports compilation without dynamic memory allocation, i.e. without any calls to malloc, calloc or realloc. Please have a look at Section 5.1.5 of the updated documentation, where this new functionality is explained.
Regards,
Andreas