我正在尝试使用已定义的库编写MPI程序。我有一名经理和多名工人。 main函数创建派生数据类型,管理器将其发送给worker。我在MPI_Isend
函数中收到以下错误。我使用gdb
跟踪错误。错误是:
Program received signal SIGSEGV, Segmentation fault.
__memmove_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2577
2577 ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: No such file or directory
该程序包含一个main.cpp
文件:
MPI_Aint extent ;
MPI_Datatype string_type;
MPI_Datatype old_types[2] = {MPI_CHAR, MPI_INT};
int blocklen[2] = {NBR_ELEMENT,2} ;
MPI_Aint disp[2], base,member ;
base_string* str_data = new base_string(NBR_ELEMENT);
disp[0] = reinterpret_cast<const unsigned char*>(str_data->get_data()) - reinterpret_cast<const unsigned char*>(str_data) ;
disp[1] = reinterpret_cast<const unsigned char*>(str_data->get_length()) - reinterpret_cast<const unsigned char*>(str_data) ;
MPI_Type_create_struct(2, blocklen, disp, types, &string_type);
MPI_Type_commit(&string_type);
base_string
在另一个有3个元素的库中。它的类包含以下功能:
inline const char* get_data( void ) const;
inline void set_data( char* data, int32_t length = -1 );
inline int32_t get_length( void ) const;
char* _data;
int32_t _length;
int32_t _nb_blocks;
在manager.cpp
包含MPI_Isend
,我收到错误:
base_string* str_dna = new base_string(NBR_ELEMENT);
str_dna->set_data(data,NBR_ELEMENT);
MPI_Request request;
MPI_Status stat;
printf("SENDING data %s \n",str_dna->get_data());
MPI_Isend(str_dna, 1,string_type, 1, 0,MPI_COMM_WORLD,&request);