eclipse-iceoryx / iceoryx

Eclipse iceoryx™ - true zero-copy inter-process-communication
https://iceoryx.io
Apache License 2.0
1.69k stars 393 forks source link

[ Error ]: ICEORYX error! MEPOO__MEMPOOL_CHUNKSIZE_MUST_BE_MULTIPLE_OF_CHUNK_MEMORY_ALIGNMENT #2337

Closed lix19937 closed 3 weeks ago

lix19937 commented 2 months ago

2022-01-01 11:45:58.305 [ Error ]: ICEORYX error! MEPOO__MEMPOOL_CHUNKSIZE_MUST_BE_MULTIPLE_OF_CHUNK_MEMORY_ALIGNMENT

elBoberido commented 2 months ago

This indicates that your mempool configuration is invalid. Are you using the TOML config or do you create it programmatically?

Anyway, you need to ensure that the payload size is a multiple of the specified memory alignment.

lix19937 commented 2 months ago

@elBoberido Thank you, I assign the TOML config, like follow

[general]
version = 1

[[segment]]
[[segment.mempool]]
size = 43336   # sizeof (1th msg) + 96 Bytes 
count = 50

[[segment.mempool]]
size = 563336   # sizeof (2th msg) + 96 Bytes 
count = 50

[[segment.mempool]]
size = 2096776  # sizeof (3th msg) + 96 Bytes 
count = 50

[[segment.mempool]]
size = 46489736  # sizeof (4th msg) + 100 Bytes , use + 96 will raise align error  
count = 70

I use ros2 galactic version. Can you give some advice how to set the TOML config ?

source /opt/ros/galactic/install/setup.bash

iox-roudi -c  `pwd`/platform/ros2/havp_nni_node/config/roudi_config.toml
lix19937 commented 2 months ago

@elBoberido Another problem, I want to know whether the addrs of borrow-loaded-msg memory are in limited range(number), I need get those addrs for static graph setting.

elBoberido commented 2 months ago

@lix19937 well, iox-roudi -c path/to/config.toml is basically the way to go. It seems your 4th message has an alignment of 4 bytes and iceoryx assumes a minimal alignment of 8. That's why you need to add additional 4 bytes to the payload size.

Another problem, I want to know whether the addrs of borrow-loaded-msg memory are in limited range(number), I need get those addrs for static graph setting.

I'm not sure what you mean with this?

lix19937 commented 2 months ago

@elBoberido Another problem, I want to know whether the addrs of borrow-loaded-msg memory are in limited range(number), I need get those addrs for static graph setting.

I means ptr here

    std::set<void *> ptr_set; /// define in Class Init 

    ...

    // runtime call 
    auto psd_loaned_msg = psd_pub_->borrow_loaned_message();
    if (!psd_loaned_msg.is_valid()){
        ERR("Failed to borrow_loaned_message!");
        raise(SIGINT);
        return;
    }
    auto &psd_pub_msg = psd_loaned_msg.get();     
    auto ptr = psd_pub_msg.data.data()  // addr  data in msg  !!!    

    ptr_set.insert(ptr );  /// I want to know the size of ptr_set is limited and fixed.   

psd_msg define follow

uint64                          stamp  
uint32                          frame_id

uint32                          frame_num
uint32                          version
uint32[4]                       reserved

uint8 TENSOR_DT_INVALID = 0
uint8 TENSOR_DT_FLOAT   = 1
uint8 TENSOR_DT_HALF    = 2
uint8 TENSOR_DT_FP8     = 3
uint8 TENSOR_DT_INT32   = 4
uint8 TENSOR_DT_INT16   = 5
uint8 TENSOR_DT_INT8    = 6
uint8 TENSOR_DT_UINT8   = 7
uint8 TENSOR_DT_INT4    = 8
int32                           data_type

# 2750*26  float 
int32[71500]                    data
lix19937 commented 2 months ago

some tips:

!!! note Actually only the chunk-payload size is configured and the size of the ChunkHeader will be added to the configured size. If a user-header or a user-payload alignment larger than 8 is used, the available size for the user-payload will be smaller than the configured chunk-payload since some space is needed for the other functionality. Please have a look at the chunk_header.md design document for a formula how to determine the necessary chunk-payload size with user-header and extended user-payload alignment.

  1. Chunksize needs to be greater than the alignment
  2. Chunksize needs to be a multiple of the alignment

https://github.com/eclipse-iceoryx/iceoryx/blob/main/doc/website/advanced/configuration-guide.md

elBoberido commented 3 weeks ago

@lix19937 I'm still not sure what you mean with

Another problem, I want to know whether the addrs of borrow-loaded-msg memory are in limited range(number), I need get those addrs for static graph setting.

All I can say is that the payload has a fixed size, everything else is not handled by iceoryx and depends on your msg file.

I'll close this issue, since the problem with iceoryx was clarified.