MPI and C structs

前端 未结 2 1436
旧时难觅i
旧时难觅i 2021-01-03 05:54

I have to admit, I was quite shocked to see how many lines of code are required to transfer one C struct with MPI.

Under what circumstances will it work to simply t

2条回答
  •  长情又很酷
    2021-01-03 06:18

    Personally I'd be more concerned about comprehensibility and maintainability, even portability, than padding. If I'm sending a structure I like my code to show that I am sending a structure, not a sequence of bytes or chars. And I expect my codes to run on multiple architectures, across multiple generations of language standards and compilers.

    I guess all I'm saying is that, if it's worth defining a structure (and you obviously think it is) then it's worth defining a structure. Saving a few lines of (near-)boilerplate isn't much of an argument against that.

提交回复
热议问题