assignメソッドでベクトルに割り当てようとしていますが、私のラップトップでは同じコードがセグメンテーションされていますが、計算クラスタでは機能します。セグメンテーション違反は、マットは、INTとダブルへのポインタとその内部データへのポインタを与えるMTL4行列で2つのポインタからのベクトル割り当てに関するsegfault
double* val = mat.address_data();
int* rp = mat.address_major();
int* cp = mat.address_minor();
// assign to the reserved location
row_pointer_data.assign(rp,
rp+(m+1));
col_index_data.assign(cp,
cp+nz);
value_data.assign(val,
val+nz);
、同様に割り当てるコール由来します。そして、これらのポインタは、それぞれnz倍、m + 1整数、nz整数のブロックを指しています。両方の環境でintel C++コンパイラを使用し、すべてのコードが同じで、両方のシェル(bashシェル)のスタックサイズは無制限です。
しかし、col_index_data.assign()コールは私のラップトップでセグメンテーション違反を起こし、クラスタ上でうまくいきます。理由ことができるもの、私は方法を割り当てるために、コールに使用されるアセンブリコマンド、_memmove_sse3()は、推測に関連する同じ行に、すなわち、
> #0 __memmove_ssse3() at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:2928
> #1 0x000000000042df49 in VibroSys::read_triplet_data (mat=Traceback (most recent call last): File
> "/home/utab/external_libraries/gdb_printers/python/mtl/printers.py",
> line 124, in to_string
> A= empty_matrix(nr, nc) File "/home/utab/external_libraries/gdb_printers/python/mtl/printers.py",
> line 38, in empty_matrix
> return [copy.deepcopy(nr * ['0']) for c in range(nc)] MemoryError
>
> , row_pointer_data=std::vector of length 19173284840251003, capacity
> 429530399489 = {...}, row_index_data=<error reading variable: Cannot
> access memory at address 0xa3bf88>,
> col_index_data=<error reading variable: Cannot access memory at address 0x100008>, value_data=std::vector of length 0, capacity
> 4764228, col_indices_on_row=Traceback (most recent call last): File
> "/home/utab/external_libraries/stl_printers/python/libstdcxx/v6/printers.py",
> line 427, in children
> rep_type = find_type(self.val.type, '_Rep_type') File "/home/utab/external_libraries/stl_printers/python/libstdcxx/v6/printers.py",
> line 43, in find_type
> field = typ.fields()[0] IndexError: list index out of range
>
> std::map with 25701680 elements, is_symmetric=false) at
> /home/utab/vibroSys/src/boost_matrix_utilities.cc:354
> #2 0x000000000042e172 in VibroSys::extract_sub_matrix (input_matrix=Traceback (most recent call last): File
> "/home/utab/external_libraries/gdb_printers/python/mtl/printers.py",
> line 124, in to_string
> A= empty_matrix(nr, nc) File "/home/utab/external_libraries/gdb_printers/python/mtl/printers.py",
> line 38, in empty_matrix
> return [copy.deepcopy(nr * ['0']) for c in range(nc)] MemoryError
>
> , sub_index1=std::vector of length 19173284840251003, capacity
> 429530399489 = {...}, sub_index2=<error reading variable: Cannot
> access memory at address 0xa3bf88>, sub_matrix=
> <error reading variable: Cannot access memory at address 0x100000>) at /home/utab/vibroSys/src/boost_matrix_utilities.cc:995
> #3 0x000000000040f93a in main (argc=36433120, argv=0xa3c000) at timing_test.cc:145
をGDBまたはvalgrindのポイントを使用して
2つの異なる環境で同じコードのこれらの2つの異なる動作のうちのどれですか?
これらのメソッドのいずれかがNULLを返す可能性はありますか?または '+ nz'は配列の終わりを超えていますか? – hmjd
'valgrind'の下で実行します。 –
あなたはマットの方法を正しく意味していますか?明らかに、アクセス違反があります。私はリポジトリから、私がやっていることを確実にするために、同じコードをチェックアウトしました。それは私を困惑させるポイントです... –