Access custom property from one API to another

satri
satri Altair Community Member

Hello

I am trying to create a custom property in Particle Replacement API and would like to access the same custom property in bond35 API can anyone please suggest how to do that?

I declared a property like this and i keep getting error

#define cp_idx 0

#define cp_idx 1

ERROR : GPU CUDA : CUDA DRIVER ERROR 700
CUDA_ERROR_ILLEGAL_ADDRESS
an illegal memory access was encountered
cuMemcpyDtoH

I dont know how to access the custom property already created. I have declared those particle custom property in the cpp section under CBonded::getNumberOfRequiredProperties and CBonded::getDetailsForProperty i have made sure the names are the same in both ParticleReplacementAPI and Bond35Api. so why am i still seeing this error and how to resolve the same

Tagged:

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • satri
    satri Altair Community Member
    image.png

    Please tell me how i can access this custom prop i have defined in particle replacement API

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi,

    The method you describe is the correct way, to make sure the custom properties are registered in the CPU code then called in the GPU code based on the ID.

    The error is suggesting the custom properties are not registered, so when it's accessing the memory to get the value there is nothing to access.

    Try putting the int value in directly rather than calling cp_idx just to check this is been registered correctly as an integer. Also is it failing on line 78 or 79? If it's running line 78 ok but not 79 it suggests that its an issue with 'emeent2' which can be particle or geometry. We have to register geometry properties separately, element1 is always particle.

    Regards

    Stephen

  • satri
    satri Altair Community Member

    i tried that too and i am getting same error

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi,

    Id recomend debugging to find out the error. It looks like you are using printf already on CUDA, I would use this to confirm the index value that is been used.

    You can then use visual studio to debug on the CPU side, although the simulation doesn't run on CPU when selecting GPU, on loading the model it registers the custom properties so you can confirm what is been setup.

    Regards

    Stephen

  • satri
    satri Altair Community Member

    i have tried using the print statement to see what the value are or the address is but everytime i use print statement i get that error

  • satri
    satri Altair Community Member

    Hey i found the error. I did not understand your statement initially. I am surprised that I am able to stop at the setup and getDetailsForProperty function. I had an else statement before declaring the particle custom properties, and it was getting skipped.

    image.png

    I put these in the end, and everything is fine now.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.