所以我有一些cmake定义ADD_EXTRA_STEP可以是true或false,并根据用户的需要设置.然后,在构建后我必须执行一些命令.我目前有这样的事情:
add_custom_command(TARGET ${some_target}
POST_BUILD
COMMAND <command to generate FOO.out>
COMMAND <command that uses FOO.out and generates FOO2.out>
COMMENT <some comment>
VERBATIM
)
add_custom_command(TARGET ${some_target}
POST_BUILD
COMMAND <some other command>
COMMENT <some other comment>
VERBATIM
)
Run Code Online (Sandbox Code Playgroud)
现在在两者之间add_custom_command我需要执行另一个命令,当且仅当if ADD_EXTRA_STEP设置为true.问题是,为了实现这一点,我需要保证FOO2.out存在.到目前为止我的想法是做这样的事情:
add_custom_command(TARGET ${some_target}
POST_BUILD
COMMAND <command to generate FOO.out>
COMMAND <command that uses FOO.out and generates FOO2.out>
COMMENT <some comment>
VERBATIM
)
if(${ADD_EXTRA_STEP})
add_custom_command(TARGET ${some_target}
POST_BUILD
COMMAND <extra step command that uses FOO2.out>
COMMENT <some extra comment> …Run Code Online (Sandbox Code Playgroud) 在过去的几天里,我一直在尝试使用 MPI 用 C 语言编写容错应用程序。我正在尝试学习如何将错误处理程序附加到 MPI_COMM_WORLD 通信器,以便在节点出现故障(可能是由于崩溃)的情况下并退出而不调用 MPI_Finalize() 程序仍然可以从这种情况中恢复并继续计算。
到目前为止,我遇到的问题是,在我将错误处理程序函数附加到通信并导致节点崩溃后,MPI 不会调用错误处理程序,而是强制所有线程退出。
我认为这可能是我的应用程序的问题,所以我在线查找示例代码并尝试运行它,但情况是相同的...我当前尝试运行的示例代码如下。(我从这里得到https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC4QFjAA&url=http%3A%2F%2Fwww.shodor.org% 2Fmedia%2Fcontent%2F%2Fpetascale%2Fmaterials%2FdistributedMemory%2Fpresentations%2FMPI_Error_Example.pdf&ei=jq6KUv-BBcO30QW1oYGABg&usg=AFQjCNFa5L_Q6Irg3VrJ3fsQBIyqjBlSgA&sig2=8An4SqBvhCACx5YLwB mROA对 PDF 格式表示歉意,但它不是我写的,所以我现在粘贴下面相同的代码):
/* Template for creating a custom error handler for MPI and a simple program
to demonstrate its' use. How much additional information you can obtain
is determined by the MPI binding in use at build/run time.
To illustrate that the program works correctly use -np 2 through -np 4.
To illustrate an MPI error set victim_mpi = 5 and use -np 6. …Run Code Online (Sandbox Code Playgroud) 所以我在编写光线跟踪器时尝试学习c ++,当我尝试使用我的makefile(首先生成.o文件然后链接它们)进行编译时,我对此错误有点挣扎.完整错误如下:
touch include/ray.h
touch include/material.h
touch include/hit.h
touch include/object.h
touch include/light.h
touch include/scene.h
touch include/sphere.h
touch include/directional_light.h
g++ -c -O -I. raytrace.cpp -o raytrace.o -std=c++0x
g++ -c -O -I. base/scene.cpp -o base/scene.o -std=c++0x
g++ -c -O -I. base/vector.cpp -o base/vector.o -std=c++0x
g++ -c -O -I. base/vertex.cpp -o base/vertex.o -std=c++0x
g++ -c -O -I. base/colour.cpp -o base/colour.o -std=c++0x
g++ -c -O -I. objects/object.cpp -o objects/object.o -std=c++0x
g++ -c -O -I. objects/sphere.cpp -o objects/sphere.o -std=c++0x
g++ -c -O -I. base/material.cpp -o …Run Code Online (Sandbox Code Playgroud)