私はKevin Beason の smallptに取り組んでいます。
プログラムは でうまく動作しclang-omp++ smallpt.cpp
ます。
しかし、以下ではうまくいきませんg++ -fopenmp smallpt.cpp
:
- 重複警告 (正常にコンパイルされました):
/var/folders/j_/5w2s7bwx4zl9r_m976qpmpcc0000gn/T//ccEDNQ2r.s:612:11: 注: セクション名を「__text」に変更します。セクション __TEXT,__textcoal_nt,coalesced,pure_instructions ^ ~~~~~~~~~~~~ ~~
/var/folders/j_/5w2s7bwx4zl9r_m976qpmpcc0000gn/T//ccEDNQ2r.s:1571:11: 警告: セクション "__textcoal_nt" は非推奨です
bus error
起動するたびにプログラムをシャットダウンします:
レンダリング (4 スーパー サンプル) 0.39%[1] 21811 バス エラー ./smallpt
コア行(行)にコメントすると279
:
SingleRay = SingleRay + radiance(SRay(Camera.m_Origin+RandDir * Scale, RandDir.normalize()), 0) * (1.0/SampleNum);
プログラムは終了せずに終了しますbus error
(暗い画像が生成されます)。
不正なメモリ アクセスは見当たりません。何が問題で、どうすれば修正できg++
ますか?
erand48()
自己定義のものに置き換えます。(関係ないかもしれません)
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++-6
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/6.2.0/libexec/gcc/x86_64-apple-darwin16.0.0/6.2.0/lto-wrapper
Target: x86_64-apple-darwin16.0.0
Configured with: ../configure --build=x86_64-apple-darwin16.0.0 --prefix=/usr/local/Cellar/gcc/6.2.0 --libdir=/usr/local/Cellar/gcc/6.2.0/lib/gcc/6 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-6 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-pkgversion='Homebrew gcc 6.2.0 --without-multilib' --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --disable-multilib
Thread model: posix
gcc version 6.2.0 (Homebrew gcc 6.2.0 --without-multilib)