@@ -237,9 +237,14 @@ private async Task WriteHpcgRunShellAsync(CancellationToken cancellationToken)
237237 // . spack/share/spack/setup-env.sh
238238 string spackSetupCommand = $ ". { this . spackDirectory } /share/spack/setup-env.sh";
239239
240+ // Giving permissions to the required files
241+ string createSpackDbDirCmd = $ "mkdir -p { this . spackDirectory } /opt/spack/.spack-db";
242+ string chownSpackDirCmd = $ "sudo chown -R $(whoami):$(whoami) { this . spackDirectory } ";
243+ string chmodSpackDirCmd = $ "chmod -R u+rwx { this . spackDirectory } ";
244+
240245 // If gcc>= 9, use zen2. if <=8, use zen.
241- // spack install -n -y hpcg %gcc@10.3.0 +openmp target=zen2 ^openmpi@4.1.1
242- string installCommand = $ "spack install --reuse -n -y hpcg@{ this . HpcgVersion } %gcc +openmp ^openmpi@{ this . OpenMpiVersion } ";
246+ // spack install -n -y hpcg %gcc@10.3.0 target=zen2 ^openmpi@4.1.1
247+ string installCommand = $ "spack install --reuse -n -y hpcg@{ this . HpcgVersion } %gcc ^openmpi@{ this . OpenMpiVersion } ";
243248
244249 // spack load hpcg %gcc@10.3.0
245250 string loadCommand = $ "spack load hpcg@{ this . HpcgVersion } %gcc ^openmpi@{ this . OpenMpiVersion } ";
@@ -249,7 +254,7 @@ private async Task WriteHpcgRunShellAsync(CancellationToken cancellationToken)
249254 int coreCount = cpuInfo . PhysicalCoreCount ;
250255 string mpirunCommand = $ "mpirun --np { coreCount } --use-hwthread-cpus --allow-run-as-root xhpcg";
251256
252- this . runShellText = string . Join ( Environment . NewLine , spackSetupCommand , installCommand , loadCommand , mpirunCommand ) ;
257+ this . runShellText = string . Join ( Environment . NewLine , spackSetupCommand , createSpackDbDirCmd , chownSpackDirCmd , chmodSpackDirCmd , installCommand , loadCommand , mpirunCommand ) ;
253258
254259 await this . systemManagement . FileSystem . File . WriteAllTextAsync ( this . hpcgRunShellPath , this . runShellText , cancellationToken ) . ConfigureAwait ( false ) ;
255260 }
0 commit comments