운영 체제 = 우분투.CPPUNIT_ASSERT_MESSAGE가 OpenMP에서 오류를 일으키는 이유는 무엇입니까?
bjam usage = TRUE.
OpenMP의 도움을 받아 단위 테스트 시스템을 최적화하고 싶습니다.
bjam 스크립트 파일 :
lib my_lib
:
[ glob sources/*.cpp ]
:
<link>static
;
...
explicit my_project ;
unit-test my_project
:
[ glob UnitTests/*.cpp ]
my_lib
:
<linkflags>-fopenmp
<cflags>-fopenmp
;
내 코드의 일부는 :
terminate called without an active exception
Aborted
내가 언급 라인 CPPUNIT_ASSERT_MESSAGE : 내 테스트 시스템을 시작하면
for(j = 0; j < AMOUNT; j++)
{
#pragma omp parallel for
for(i = 0; i < 0x10000; ++i)
{
...
try
{
variable1 = func1();
variable2 = func2();
//variable1 and variable 2 must be equal
CPPUNIT_ASSERT_MESSAGE("OLOLO", variable1 == variable2);
}
catch (const std::logic_error& exception)
{
std::cerr << exception.what() << std::endl;
CPPUNIT_ASSERT_MESSAGE("OLOLO", 0);
}
catch (const std::runtime_error & exception)
{
std::cerr << exception.what() << std::endl;
CPPUNIT_ASSERT_MESSAGE("OLOLO", 0);
}
}
}
이 오류와 함께 종료 :
for(j = 0; j < AMOUNT; j++)
{
#pragma omp parallel for
for(i = 0; i < 0x10000; ++i)
{
...
try
{
variable1 = func1();
variable2 = func2();
//CPPUNIT_ASSERT_MESSAGE("OLOLO", variable1 == variable2);
}
catch (const std::logic_error& exception)
{
std::cerr << exception.what() << std::endl;
//CPPUNIT_ASSERT_MESSAGE("OLOLO", 0);
}
catch (const std::runtime_error & exception)
{
std::cerr << exception.what() << std::endl;
//CPPUNIT_ASSERT_MESSAGE("OLOLO", 0);
}
}
}
그리고 내가 필요한 방식으로 작동합니다. 하지만 잘못된 결과가 발생할 경우 정보를 출력하려면 CPPUNIT_ASSERT_MESSAGE가 필요합니다. CPPUNIT_ASSERT_MESSAGE가 오류를 일으키는 이유와 이러한 오류를 제거하기 위해 무엇을해야합니까?