54 #include <Teuchos_GlobalMPISession.hpp> 55 #include <Teuchos_RCP.hpp> 59 #ifdef HAVE_ZOLTAN2_SCOTCH 63 #ifndef HAVE_ZOLTAN2_MPI 69 #endif // HAVE_ZOLTAN2_SCOTCH 71 #ifdef HAVE_ZOLTAN2_PARMETIS 73 #ifndef HAVE_ZOLTAN2_MPI 76 #error "TPL ParMETIS requires compilation with MPI. Configure with -DTPL_ENABLE_MPI:BOOL=ON or -DZoltan2_ENABLE_ParMETIS:BOOL=OFF" 84 #if (PARMETIS_MAJOR_VERSION < 4) 87 #error "Specified version of ParMETIS is not compatible with Zoltan2; upgrade to ParMETIS v4 or later, or build Zoltan2 without ParMETIS." 92 #define PARMETIS_IS_OK 1 94 #endif // ParMETIS version check 95 #endif // HAVE_ZOLTAN2_MPI 96 #endif // HAVE_ZOLTAN2_PARMETIS 100 #define PRINTMSG(s) \ 101 std::cout << (s) << " " << __FILE__ << ":" << __LINE__ << std::endl 103 int main(
int argc,
char *argv[])
105 Teuchos::GlobalMPISession session(&argc, &argv);
120 catch (std::exception &e) {
126 unsigned int zgno = 123;
129 catch (std::exception &e) {
130 PRINTMSG(
"FAIL: unsigned int to int");
138 catch (std::exception &e) {
147 catch (std::exception &e) {
154 long long zgno = (
long long)1 << 40;
157 catch (std::exception &e) {
158 PRINTMSG(
"GOOD: big long long to int throws exception");
162 size_t zgno = (size_t)1 << 40;
165 catch (std::exception &e) {
166 PRINTMSG(
"GOOD: big size_t to int throws exception");
170 unsigned zgno = (1 << 31) + 1;
173 catch (std::exception &e) {
174 PRINTMSG(
"GOOD: huge unsigned to int throws exception");
184 long long zgno = (
long long)1 << 40;
187 catch (std::exception &e) {
188 PRINTMSG(
"FAIL: big long long to size_t");
193 size_t zgno = (size_t)1 << 40;
196 catch (std::exception &e) {
197 PRINTMSG(
"FAIL: big size_t to size_t");
208 long long zgno = (
long long)1 << 40;
211 catch (std::exception &e) {
212 PRINTMSG(
"FAIL: big long long to int64_t");
217 size_t zgno = (size_t)1 << 40;
220 catch (std::exception &e) {
221 PRINTMSG(
"FAIL: big size_t to int64_t");
227 size_t zgno = ((size_t)1 << 63) + 1 ;
230 catch (std::exception &e) {
231 PRINTMSG(
"GOOD: huge size_t to int64_t threw exception");
234 #ifdef HAVE_ZOLTAN2_SCOTCH 238 SCOTCH_Num scotchIdx;
246 catch (std::exception &e) {
247 PRINTMSG(
"FAIL: int to SCOTCH_Num");
252 unsigned int zgno = 123;
255 catch (std::exception &e) {
256 PRINTMSG(
"FAIL: unsigned int to SCOTCH_Num");
264 catch (std::exception &e) {
265 PRINTMSG(
"FAIL: long to SCOTCH_Num");
273 catch (std::exception &e) {
274 PRINTMSG(
"FAIL: size_t to SCOTCH_Num");
278 if (
sizeof(SCOTCH_Num) == 8) {
281 long long zgno = (
long long)1 << 40;
284 catch (std::exception &e) {
285 PRINTMSG(
"FAIL: big unsigned int to SCOTCH_Num");
290 size_t zgno = (size_t)1 << 40;
293 catch (std::exception &e) {
294 PRINTMSG(
"FAIL: big size_t to SCOTCH_Num");
300 if (
sizeof(SCOTCH_Num) == 4) {
302 long long zgno = (
long long)1 << 40;
305 catch (std::exception &e) {
306 PRINTMSG(
"GOOD: big long long to 4-byte SCOTCH_Num throws exception");
310 size_t zgno = (size_t)1 << 40;
313 catch (std::exception &e) {
314 PRINTMSG(
"GOOD: big size_t to 4-byte SCOTCH_Num throws exception");
318 #endif // HAVE_ZOLTAN2_SCOTCH 320 #ifdef PARMETIS_IS_OK 332 catch (std::exception &e) {
333 PRINTMSG(
"FAIL: int to ParMETIS' idx_t");
338 unsigned int zgno = 123;
341 catch (std::exception &e) {
342 PRINTMSG(
"FAIL: unsigned int to ParMETIS' idx_t");
350 catch (std::exception &e) {
351 PRINTMSG(
"FAIL: long to ParMETIS' idx_t");
359 catch (std::exception &e) {
360 PRINTMSG(
"FAIL: size_t to ParMETIS' idx_t");
364 if (
sizeof(idx_t) == 8) {
367 long long zgno = (
long long)1 << 40;
370 catch (std::exception &e) {
371 PRINTMSG(
"FAIL: big unsigned int to ParMETIS' idx_t");
376 size_t zgno = (size_t)1 << 40;
379 catch (std::exception &e) {
380 PRINTMSG(
"FAIL: big size_t to ParMETIS' idx_t");
386 if (
sizeof(idx_t) == 4) {
388 long long zgno = (
long long)1 << 40;
391 catch (std::exception &e) {
392 PRINTMSG(
"GOOD: big long long to 4-byte ParMETIS' idx_t throws exception");
396 size_t zgno = (size_t)1 << 40;
399 catch (std::exception &e) {
400 PRINTMSG(
"GOOD: big size_t to 4-byte ParMETIS' idx_t throws exception");
407 std::cout <<
"PASS" << std::endl;
409 std::cout <<
"FAIL" << std::endl;
static void ASSIGN_TPL_T(tpl_t &a, zno_t b, const RCP< const Environment > &env)
int main(int argc, char *argv[])
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
Traits class to handle conversions between gno_t/lno_t and TPL data types (e.g., ParMETIS's idx_t...
Defines the Environment class.