kaityo256 / cps Goto Github PK
View Code? Open in Web Editor NEWCommand Processor Scheduler
License: MIT License
Command Processor Scheduler
License: MIT License
Qiitaの記事を読んできました.
Line 129 in 7b8667c
std::unique_ptr<char>
でnew char[len]
を受けていますが,これはdelete []
ではなくdelete
を実行するので正しくメモリが解放されません.std::unique_ptr<char[]>
を使用すべきかと思います.
参考: https://cpprefjp.github.io/reference/memory/unique_ptr.html
の配列版・「new[]演算子で~」の部分
2/21版のコードで以下のエラーによりコンパイルが通りません.
[user@host cps]$ make
mpicxx -Wall -Wextra -std=c++11 cps.cpp -o cps
cps.cpp: In function ‘void worker(int)’:
cps.cpp:112:5: error: ‘unique_ptr’ is not a member of ‘std’
std::unique_ptr<char[]> buf(new char[len]);
^~~
cps.cpp:112:21: error: expected primary-expression before ‘char’
std::unique_ptr<char[]> buf(new char[len]);
^~~~
cps.cpp:113:14: error: ‘buf’ was not declared in this scope
MPI_Recv(buf.get(), len, MPI_CHAR, 0, 0, MPI_COMM_WORLD, &st);
^~~
makefile:7: recipe for target 'cps' failed
make: *** [cps] Error 1
当方のコンパイラは,CentOS7.6上のSCLのdevtoolset-6をOpenMPI 4.0.2でコンパイルしたものになります.
[user@host cps]$ mpixx -v
Using built-in specs.
COLLECT_GCC=/opt/rh/devtoolset-6/root/usr/bin/c++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-6/root/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-6/root/usr --mandir=/opt/rh/devtoolset-6/root/usr/share/man --infodir=/opt/rh/devtoolset-6/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-6.3.1-20170216/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 6.3.1 20170216 (Red Hat 6.3.1-3) (GCC)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.