Commit 67162480 authored by Berrill, Mark's avatar Berrill, Mark
Browse files

Updating test

parent 77d13c2d
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ int run_tests( const std::string &filename, const Options &options )
    for ( size_t i = 0; i < methods.size(); i++ ) {
        if ( rank == 0 )
            std::cout << "  Running " << methods[i] << std::endl;
        bool serial    = methods[i] == "cpu" || methods[i] == "Kokkos-Serial";
        bool serial    = methods[i] == "cpu" || methods[i] == "kokkos-serial";
        int iterations = options.iterations;
        if ( serial && methods.size() > 1 )
            iterations = 1;
@@ -150,7 +150,13 @@ int run_tests( const std::string &filename, const Options &options )
                N_errors++;
        }
        if ( perf1[i].avg[0] > 2.0 * perf1[i].avg[1] ) {
            printf( "    Slow rank detected: %i\n", rank );
            auto host = hostname();
            if ( methods[i] == "cuda" ) {
                int id = getDeviceID();
                printf( "    Slow rank detected: %s:%i, %i\n", host.c_str(), id, rank );
            } else {
                printf( "    Slow rank detected: %s, %i\n", host.c_str(), rank );
            }
            N_errors++;
        }
        barrier();
+19 −4
Original line number Diff line number Diff line
@@ -267,6 +267,24 @@ Times::Times( const std::vector<double> &x )
/**********************************************************************
 * Print info about the hardware                                       *
 **********************************************************************/
std::string hostname()
{
    char hostname[1000];
    gethostname( hostname, sizeof( hostname ) );
    return std::string( hostname );
}
int getDeviceID()
{
#ifdef USE_CUDA
    int device;
    struct cudaDeviceProp prop;
    cudaGetDevice( &device );
    cudaGetDeviceProperties( &prop, device );
    return prop.pciDeviceID;
#else
    return -1;
#endif
}
void printHardware()
{
    // Get number of threads
@@ -296,11 +314,8 @@ void printHardware()
#else
#error Unknown OS
#endif
    // Get the hostname
    char hostname[1000];
    gethostname( hostname, sizeof( hostname ) );
    // Print the results
    std::cout << "Hostname: " << hostname << std::endl;
    std::cout << "Hostname: " << hostname() << std::endl;
    std::cout << "Number of threads: " << N_threads << std::endl;
    std::cout << "Number of gpus: " << N_gpu << std::endl;
    std::cout << "System memory: " << N_bytes / 1073741824 << " GB" << std::endl << std::endl;
+8 −0
Original line number Diff line number Diff line
@@ -39,6 +39,14 @@ struct Times {
};


// Function to get the hostname
std::string hostname();


// Get active device id
int getDeviceID();


// Function to print info about the hardware that we will use
void printHardware();