About EDEM API tutorial in linux and GPU solver conversion

QinHe_321
QinHe_321 Altair Community Member

I have several packed dll about 'custom factory', 'custom particle body force' and 'custom contact model', also have the corresponding visutalstudio2017 header files.

How can I transfer them into linux .so document, and make them avalible for GPU solver? How does the packing works? and how do I compile .cu files?

I know there are several tutorial exists, but they are hard to follow because they are vague. It would be really helpful if there's step by step video tutorial.

Thanks

Qin

Tagged:

Answers

  • PrasadAvilala
    PrasadAvilala
    Altair Employee

    Hi Qin,

    Please find the attached document the steps to convert dll to .so (Linux supported format) is explained from page-12 .

    Hope this helps.

    Thanks,

    Prasad A

  • QinHe_321
    QinHe_321 Altair Community Member

    Yes, but how can I compile my own .cl document? or can I use same .cl for every compile?

  • PrasadAvilala
    PrasadAvilala
    Altair Employee

    .cl file is a GPU compatibility file if you convert to linux it supports GPU.

    I suggest please go through the document and compile the steps, the attached document explains the detailed steps

  • QinHe_321
    QinHe_321 Altair Community Member

    Yes, but how can I compile my own .cl document? or can I use same .cl for every compile?

    This question is not answered in pdf.

  • PrasadAvilala
    PrasadAvilala
    Altair Employee

    Please compile and check it should work, if it is not working please share the error message.

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi , as Prasad mentions you don't need to compile the CUDA specific file. There is an overview video on EDEM GPU API here:

    it's part of a series, part 1 is here:

  • QinHe_321
    QinHe_321 Altair Community Member

    Above is cpp for dll, while below is confinement.cu

    they are both in "C:\Users\a1312\OneDrive\Documents\Altair\EDEM2024\ParticleBodyForce", but EDEM still recognize it as cpu only document

  • QinHe_321
    QinHe_321 Altair Community Member

    I updated cu, still didn't work

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi, do the file names match? You are defining the name of the .cu file in the CPU code under "GPU_FILENAME" , this name should match the name of the .cu file you have.

    Regards

    Stephen

  • QinHe_321
    QinHe_321 Altair Community Member

    the names are

    confinement.dll

    confinement.cu

  • Stephen Cole
    Stephen Cole
    Altair Employee
    edited February 4

    Hi,

    Just to confirm did you change the code here "wtf" should read "confinement" as this is the name of the GPU file you are reading. You will have to recompile the CPU code afterwards to make sure this change is applied in the new model.

  • QinHe_321
    QinHe_321 Altair Community Member

    The model is still cpu only after I change "wtf" into "confinement"

  • QinHe_321
    QinHe_321 Altair Community Member

    #ifndef CUDACC
    #include "cudaApiCore.cuh"
    #include "apiConstants.cuh"
    #include "CApiContact.cuh"
    #include "CApiContactResults.cuh"
    #include "CApiCustomPropertyData.cuh"
    #include "CApiElement.cuh"
    #include "CApiFieldData.cuh"
    #include "CApiInteraction.cuh"
    #include "CApiParticle.cuh"
    #include "CApiSimulation.cuh"
    #include "CApiTotalForce.cuh"
    #include "CApiGeomTriangleInfo.cuh"
    #include "CApiTriangleDeformationResult.cuh"
    #include "CMat3x3.cuh"
    #include "CQuaternion.cuh"
    #include "CUtilitiesEquations.cuh"
    #include "CUtilitiesMath.cuh"
    #include "CUtilitiesPrecision.cuh"
    #include "CVec3.cuh"
    #endif

    I found another tutorial have such include document, where can I find the menu of including requirement

  • QinHe_321
    QinHe_321 Altair Community Member

    or maybe it is not recognized because I didn't add starting() and all other functions in cpp?

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi,

    I would make sure the version of the code you are using is all up to date with your installed version

    The detailed API documentation is in C:\Program Files\Altair\2024.1\EDEM\src\Api\Help > index.html (or your installed location) which gives all the functions. Starting runs some code on pressing play in the Simulator, it is not needed as standard but can be useful in some cases.

  • QinHe_321
    QinHe_321 Altair Community Member

    the error is so weird, obviously I already defined GETFINTERFACE, but it still happens

  • QinHe_321
    QinHe_321 Altair Community Member

    I solved the CUDA problem by adding a empty preference file function, it is necessary.

    But not I couldn't find header files' location in linux server.

  • Stephen Cole
    Stephen Cole
    Altair Employee

    Hi, the folder structure for the header files is the same on Windows and Linux, but the default install location for the software may be different. If you have the altair isntall folder you can find then the header files in /version number/edem//src/Api

    The files are the same on Windows and Linux, so you can just copy the required header files for the API from your windows install to the Linux machine if it's easier.


    Regards

    Stephen

  • QinHe_321
    QinHe_321 Altair Community Member

    yes, it's inside linux_apps folder, with similar directory.

    And I found another error in help document, it should be g++ instead of gcc, to compile .so correctly.

    And \

    -I

    is necessary for linux terminal, but the tutorial didn't mention about "\"

    Q