Skip to content

Commit

Permalink
added ability to run evpfft solver with mpi ranks
Browse files Browse the repository at this point in the history
  • Loading branch information
shankinsMechEng committed Dec 23, 2024
1 parent b31d8ef commit 7e82640
Show file tree
Hide file tree
Showing 5 changed files with 430 additions and 27 deletions.
32 changes: 25 additions & 7 deletions python/FIERRO-GUI/fierro_gui/Bulk_Forming.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,14 @@ def boundary_conditions():
self.TCstress.setItem(1,1,QTableWidgetItem("0."))
self.INbulkBC.currentIndexChanged.connect(boundary_conditions)

# Select serial or parallel run type
self.INBFSerial.toggled.connect(lambda: self.BFRunType.setCurrentIndex(0))
self.INBFParallel.toggled.connect(lambda: self.BFRunType.setCurrentIndex(1))

# Set number of mpi ranks based on the number of cores that are avaliable on the system
num_cores = os.cpu_count()
self.INBFmpiRanks.setMaximum(num_cores)

# Run Bulk Formation
self.run = 0
def run_bulk_forming():
Expand All @@ -1146,15 +1154,25 @@ def run_bulk_forming():
file_type = os.path.splitext(in_file_path)[1].lower()
reload(DeveloperInputs)
if self.UserConfig == "Developer":
executable_path = DeveloperInputs.fierro_evpfft_exe
if self.INBFParallel.isChecked():
executable_path = "mpirun"
else:
executable_path = DeveloperInputs.fierro_evpfft_exe
elif self.UserConfig == "User":
executable_path = "evpfft"
if ".txt" in file_type:
arguments = ["-f", self.BULK_FORMING_INPUT]
elif ".vtk" in file_type:
arguments = ["-f", self.BULK_FORMING_INPUT, "-m", "2"]
if self.INBFParallel.isChecked():
executable_path = "mpirun"
else:
executable_path = "evpfft"
if ".vtk" in file_type:
if self.INBFParallel.isChecked():
arguments = ["-np", self.INBFmpiRanks.value(), "evpfft", "-f", self.BULK_FORMING_INPUT, "-m", "2"]
else:
arguments = ["-f", self.BULK_FORMING_INPUT, "-m", "2"]
else:
warning_message("ERROR: Trying to run an incorrect file type.")
if self.INBFParallel.isChecked():
arguments = ["-np", self.INBFmpiRanks.value(), "evpfft", "-f", self.BULK_FORMING_INPUT]
else:
arguments = ["-f", self.BULK_FORMING_INPUT]

# Set up the environment
self.p = QProcess()
Expand Down
235 changes: 231 additions & 4 deletions python/FIERRO-GUI/fierro_gui/FIERRO_GUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
<number>1</number>
</property>
<property name="currentIndex">
<number>2</number>
<number>7</number>
</property>
<widget class="QWidget" name="TitleTool">
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down Expand Up @@ -1059,7 +1059,7 @@
<x>0</x>
<y>0</y>
<width>376</width>
<height>548</height>
<height>541</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -10324,7 +10324,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
<item>
<widget class="QStackedWidget" name="RunOptions">
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="page_20">
<layout class="QVBoxLayout" name="verticalLayout_12">
Expand Down Expand Up @@ -10352,7 +10352,20 @@ li.checked::marker { content: &quot;\2612&quot;; }
</widget>
<widget class="QWidget" name="page_21">
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_53">
<property name="font">
<font>
<bold>true</bold>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Job Type</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame_16">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
Expand Down Expand Up @@ -10567,6 +10580,113 @@ li.checked::marker { content: &quot;\2612&quot;; }
</widget>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_54">
<property name="font">
<font>
<bold>true</bold>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Run Type</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame_59">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="INHSerial">
<property name="text">
<string>Serial</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="INHParallel">
<property name="text">
<string>Parallel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item alignment="Qt::AlignTop">
<widget class="QStackedWidget" name="HomogenizationRunType">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page_31"/>
<widget class="QWidget" name="page_32">
<layout class="QFormLayout" name="formLayout_9">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QSpinBox" name="INmpiRanks">
<property name="readOnly">
<bool>false</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::UpDownArrows</enum>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_58">
<property name="text">
<string>MPI Ranks:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QPushButton" name="BRunEVPFFT2">
<property name="text">
Expand All @@ -10591,6 +10711,113 @@ li.checked::marker { content: &quot;\2612&quot;; }
</widget>
<widget class="QWidget" name="page_24">
<layout class="QVBoxLayout" name="verticalLayout_39">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_62">
<property name="font">
<font>
<bold>true</bold>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>Run Type</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame_63">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_11">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="INBFSerial">
<property name="text">
<string>Serial</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="INBFParallel">
<property name="text">
<string>Parallel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item alignment="Qt::AlignTop">
<widget class="QStackedWidget" name="BFRunType">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page_33"/>
<widget class="QWidget" name="page_34">
<layout class="QFormLayout" name="formLayout_12">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QSpinBox" name="INBFmpiRanks">
<property name="readOnly">
<bool>false</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::UpDownArrows</enum>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_63">
<property name="text">
<string>MPI Ranks:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QPushButton" name="BRunBulkForming">
<property name="text">
Expand Down
28 changes: 24 additions & 4 deletions python/FIERRO-GUI/fierro_gui/Homogenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,13 +615,25 @@ def single_EVPFFT(BC_index):
file_type = os.path.splitext(in_file_path)[1].lower()
reload(DeveloperInputs)
if self.UserConfig == "Developer":
executable_path = DeveloperInputs.fierro_evpfft_exe
if self.INHParallel.isChecked():
executable_path = "mpirun"
else:
executable_path = DeveloperInputs.fierro_evpfft_exe
elif self.UserConfig == "User":
executable_path = "evpfft"
if self.INHParallel.isChecked():
executable_path = "mpirun"
else:
executable_path = "evpfft"
if ".vtk" in file_type:
arguments = ["-f", self.EVPFFT_INPUT, "-m", "2"]
if self.INHParallel.isChecked():
arguments = ["-np", self.INmpiRanks.value(), "evpfft", "-f", self.EVPFFT_INPUT, "-m", "2"]
else:
arguments = ["-f", self.EVPFFT_INPUT, "-m", "2"]
else:
arguments = ["-f", self.EVPFFT_INPUT]
if self.INHParallel.isChecked():
arguments = ["-np", self.INmpiRanks.value(), "evpfft", "-f", self.EVPFFT_INPUT]
else:
arguments = ["-f", self.EVPFFT_INPUT]

# Make a new directory to store all of the outputs
if BC_index == 0:
Expand Down Expand Up @@ -876,6 +888,14 @@ def batch_geometry():
self.INSingleJob.toggled.connect(lambda: self.HomogenizationBatch.setCurrentIndex(0))
self.INBatchJob.toggled.connect(lambda: self.HomogenizationBatch.setCurrentIndex(1))

# Select serial or parallel run type
self.INHSerial.toggled.connect(lambda: self.HomogenizationRunType.setCurrentIndex(0))
self.INHParallel.toggled.connect(lambda: self.HomogenizationRunType.setCurrentIndex(1))

# Set number of mpi ranks based on the number of cores that are avaliable on the system
num_cores = os.cpu_count()
self.INmpiRanks.setMaximum(num_cores)

# # Upload HDF5
# def upload_hdf5_click():
# global hdf5_filename
Expand Down
6 changes: 6 additions & 0 deletions python/FIERRO-GUI/fierro_gui/Reload_Geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,15 @@ def Reload_Geometry(self):
self.render_view.ResetCamera()
self.render_view.StillRender()
elif self.file_type == ".txt":
# input file location
Data_filename = self.TParts.item(0,10).text()

# output file location
vtk_location = self.voxelizer_dir + '/VTK_Geometry_' + self.TParts.item(0,0).text() + '.vtk'

# convert text file to vtk file for visualization
los_alamos_to_vtk(Data_filename, vtk_location)

# Paraview window
self.txt_reader = paraview.simple.LegacyVTKReader(FileNames = vtk_location)
paraview.simple.SetDisplayProperties(Representation = "Surface")
Expand Down
Loading

0 comments on commit 7e82640

Please sign in to comment.