Skip to content

Commit

Permalink
Merge branch 'develop' into lroberts36/add-multi-grid
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 authored Oct 18, 2023
2 parents c779ddf + 7395ed5 commit c7918c1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [[PR 885]](https://github.com/parthenon-hpc-lab/parthenon/pull/885) Expose PackDescriptor and use uids in SparsePacks

### Fixed (not changing behavior/API/variables/...)
- [[PR 955]](https://github.com/parthenon-hpc-lab/parthenon/pull/955) Only permit rank0 to mkdir when -d flag specified
- [[PR 952]](https://github.com/parthenon-hpc-lab/parthenon/pull/954) Fix format string in sparse advection example
- [[PR 947]](https://github.com/parthenon-hpc-lab/parthenon/pull/947) Add missing ForceRemeshComm dependencies
- [[PR 928]](https://github.com/parthenon-hpc-lab/parthenon/pull/928) Fix boundary comms during refinement next to refined blocks
Expand Down
30 changes: 19 additions & 11 deletions src/utils/change_rundir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Copyright(C) 2014 James M. Stone <[email protected]> and other code contributors
// Licensed under the 3-clause BSD License, see LICENSE file for details
//========================================================================================
// (C) (or copyright) 2020. Triad National Security, LLC. All rights reserved.
// (C) (or copyright) 2023. Triad National Security, LLC. All rights reserved.
//
// This program was produced under U.S. Government contract 89233218CNA000001 for Los
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC
Expand All @@ -27,6 +27,8 @@
#include <stdexcept>

#include "defs.hpp"
#include "globals.hpp"
#include "parthenon_mpi.hpp"
#include "utils/error_checking.hpp"

namespace fs = FS_NAMESPACE;
Expand All @@ -42,19 +44,25 @@ void ChangeRunDir(const char *pdir) {

if (pdir == nullptr || *pdir == '\0') return;

if (!fs::exists(pdir)) {
if (!fs::create_directories(pdir)) {
msg << "### FATAL ERROR in function [ChangeToRunDir]" << std::endl
<< "Cannot create directory '" << pdir << "'";
PARTHENON_THROW(msg);
}
if (parthenon::Globals::my_rank == 0) {
if (!fs::exists(pdir)) {
if (!fs::create_directories(pdir)) {
msg << "### FATAL ERROR in function [ChangeToRunDir]" << std::endl
<< "Cannot create directory '" << pdir << "'";
PARTHENON_THROW(msg);
}

// in POSIX, this is 0755 permission, rwxr-xr-x
auto perms = fs::perms::owner_all | fs::perms::group_read | fs::perms::group_exec |
fs::perms::others_read | fs::perms::others_exec;
fs::permissions(pdir, perms);
// in POSIX, this is 0755 permission, rwxr-xr-x
auto perms = fs::perms::owner_all | fs::perms::group_read | fs::perms::group_exec |
fs::perms::others_read | fs::perms::others_exec;
fs::permissions(pdir, perms);
}
}

#ifdef MPI_PARALLEL
MPI_Barrier(MPI_COMM_WORLD);
#endif

if (chdir(pdir)) {
msg << "### FATAL ERROR in function [ChangeToRunDir]" << std::endl
<< "Cannot cd to directory '" << pdir << "'";
Expand Down

0 comments on commit c7918c1

Please sign in to comment.