Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Removed coarray for now
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Nov 28, 2022
1 parent e3c03e6 commit ea4e0ed
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cmake/Modules/FindOpenMP_Fortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ INCLUDE (${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)

SET (OpenMP_Fortran_FLAG_CANDIDATES
#Intel
"-qopenmp -coarray"
"-qopenmp"
#Intel windows
"/Qopenmp /Qcoarray"
"/Qopenmp"
#Gnu
"-fopenmp -fcoarray=lib"
"-fopenmp"
#Portland Group
"-mp"
#Empty, if compiler automatically accepts openmp
Expand Down
119 changes: 119 additions & 0 deletions examples/Basic_Simulation/run_from_file.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "aa57e957-f141-4373-9a62-a91845203aa3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"env: OMP_NUM_THREADS=8\n"
]
}
],
"source": [
"import swiftest\n",
"import xarray as xr\n",
"import numpy as np\n",
"import os\n",
"%env OMP_NUM_THREADS=8"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "a9c020aa-0a87-4fa9-9b11-62213edb370c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading Swiftest file /home/daminton/git_debug/swiftest/examples/Basic_Simulation/simdata/param.in\n",
"\n",
"Creating Dataset from NetCDF file\n",
"Successfully converted 1 output frames.\n"
]
}
],
"source": [
"sim = swiftest.Simulation(read_param=True)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "209523b6-d7a8-46f0-8687-54f199015c2d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Writing parameter inputs to file /home/daminton/git_debug/swiftest/examples/Basic_Simulation/simdata/param.in\n",
"Running a Swiftest symba run from tstart=0.0 y to tstop=1000.0 y\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ca7e9529651b46209bc86174955f7a01",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Time: 0.0 / 1000.0 y : 0%| , npl: 14 ntp: 10 nplm: 13"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/daminton/git_debug/swiftest/python/swiftest/swiftest/simulation_class.py:465: UserWarning: Error executing main swiftest_driver program\n",
" self._run_swiftest_driver()\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Creating Dataset from NetCDF file\n",
"Successfully converted 19 output frames.\n",
"Swiftest simulation data stored as xarray DataSet .data\n"
]
}
],
"source": [
"sim.run()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (My debug_env Kernel)",
"language": "python",
"name": "debug_env"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
13 changes: 8 additions & 5 deletions python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,12 @@ def _type_scrub(output_data):
process_output = False
noutput = int((self.param['TSTOP'] - self.param['T0']) / self.param['DT'])
iloop = int((self.param['TSTART'] - self.param['T0']) / self.param['DT'])
post_message = f"Time: {self.param['TSTART']} / {self.param['TSTOP']} {self.TU_name} "
post_message += f"npl: {self.data['npl'].values[0]} ntp: {self.data['ntp'].values[0]}"
if self.param['TSTOP'] < 1e4:
pre_message = f"Time: {self.param['TSTART']:>5} / {self.param['TSTOP']:>5} {self.TU_name} "
post_message = f"npl: {self.data['npl'].values[0]} ntp: {self.data['ntp'].values[0]}"
if "nplm" in self.data:
post_message += f" nplm: {self.data['nplm'].values[0]}"
pbar = tqdm(total=noutput, postfix=post_message, bar_format='{l_bar}{bar}{postfix}')
pbar = tqdm(total=noutput, desc=pre_message, postfix=post_message, bar_format='{l_bar}{bar}{postfix}')
try:
with subprocess.Popen(shlex.split(cmd),
stdout=subprocess.PIPE,
Expand All @@ -402,13 +403,15 @@ def _type_scrub(output_data):
if process_output:
kvstream=line.replace('\n','').strip().split(';') # Removes the newline character,
output_data = _type_scrub({kv.split()[0]: kv.split()[1] for kv in kvstream[:-1]})
post_message = f"Time: {output_data['T']} / {self.param['TSTOP']} {self.TU_name}"
post_message += f" npl: {output_data['NPL']} ntp: {output_data['NTP']}"
if self.param['TSTOP'] < 1e4:
pre_message = f"Time: {output_data['T']:>5} / {self.param['TSTOP']:>5} {self.TU_name}"
post_message = f" npl: {output_data['NPL']} ntp: {output_data['NTP']}"
if "NPLM" in output_data:
post_message += f" nplm: {output_data['NPLM']}"
interval = output_data['ILOOP'] - iloop
if interval > 0:
pbar.update(interval)
pbar.set_description_str(pre_message)
pbar.set_postfix_str(post_message)
iloop = output_data['ILOOP']

Expand Down

0 comments on commit ea4e0ed

Please sign in to comment.