Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use averaged zone cycles and check if input deck exists #26

Merged
merged 5 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Purpose : Main driver routine
**/

#include <filesystem> // std::exists
#include <iostream>
#include <string>
#include <vector>
Expand All @@ -31,9 +32,15 @@
int main( int argc, char *argv[] ) {
// Check cmd line args
if ( argc < 2 ) {
throw Error( "No input file passed! Do: ./main IN_FILE" );
throw Error( "! No input file passed! Do: ./main IN_FILE" );
}

// ensure input deck exists
if ( !std::filesystem::exists( argv[1] ) ) {
throw Error( " ! Invalid path passed for athelas input deck!\n" );
}

// load input deck
ProblemIn pin( argv[1] );

/* --- Problem Parameters --- */
Expand Down Expand Up @@ -105,7 +112,8 @@ int main( int argc, char *argv[] ) {
// --- Timer ---
Kokkos::Timer timer_total;
Kokkos::Timer timer_zone_cycles;
Real zc_ws = 0.0; // zone cycles / wall second
Real zc_ws = 0.0; // zone cycles / wall second
Real time_cycle = 0.0;

// --- Evolution loop ---
int iStep = 0;
Expand Down Expand Up @@ -148,13 +156,20 @@ int main( int argc, char *argv[] ) {
#endif

t += dt;
time_cycle += timer_zone_cycles.seconds( );
timer_zone_cycles.reset( );

// Write state
if ( iStep % i_write == 0 ) {
WriteState( &state, Grid, &S_Limiter, ProblemName, t, order, i_out );
i_out += 1;
}

if ( iStep % i_print == 0 ) {
zc_ws = static_cast<Real>( i_print ) * nX / time_cycle;
std::printf( " ~ %d %.5e %.5e %.5e \n", iStep, t, dt, zc_ws );
time_cycle = 0.0;
}
iStep++;
Real time_cycle = timer_zone_cycles.seconds( );
zc_ws = nX / time_cycle;
Expand Down
Loading