Labels

Friday, December 30, 2022

Install Slurm on my personal Fedora laptop

Slurm (Simple Linux Utility for Resource Management) is a group utilities used for managing workloads on computer clusters. It can also be sued in your personal laptop. 


  $sudo dnf install slurm slurm-slurmd slurm-slumrctld
  $sudo -u munge /usr/sbin/mungekey -v
  $sudo systemctl start munge
  $sudo systemctl status munge
  $sudo systemctl enable munge
  $munge -n | unmunge // check munge works
  $hostname -f // find out hostname
  $sudo vi  /etc/slurm/slurm.conf
  


ClusterName=localcluster
SlurmctldHost=localhost  // or hostname
MpiDefault=pmix
ProctrackType=proctrack/cgroup
ReturnToService=1
SlurmctldPidFile=/var/run/slurm/slurmctld.pid
SlurmctldPort=6817
SlurmdPidFile=/var/run/slurm/slurmd.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurm/d
SlurmUser=root
StateSaveLocation=/var/spool/slurm/ctld
SwitchType=switch/none
InactiveLimit=0
KillWait=30
MinJobAge=300
SlurmctldTimeout=120
SlurmdTimeout=300
Waittime=0

SchedulerType=sched/backfill
SelectType=select/linear
AccountingStorageType=accounting_storage/none
AccountingStoreFlags=job_comment
JobCompType=jobcomp/none
JobAcctGatherFrequency=30
JobAcctGatherType=jobacct_gather/none
SlurmctldDebug=info
SlurmctldLogFile=/var/log/slurm/slurmctld.log
SlurmdDebug=info
SlurmdLogFile=/var/log/slurm/slurmd.log
NodeName=localhost CPUs=12 Sockets=1 CoresPerSocket=6 ThreadsPerCore=2 RealMemory=10000 State=UNKNOWN
PartitionName=sbatch Nodes=ALL Default=YES MaxTime=INFINITE State=UP


change the Node information (marked as red color) to your laptop configuration. 

$ sudo systemctl start slurmctld
$ sudo systemctl status slurmctld
$ sudo systemctl enable slurmctld
$ sudo systemctl status slurmd
$ sudo systemctl enable slurmd

// test the installation
$ srun ls 


Reference:

https://src.fedoraproject.org/rpms/munge

http://docs.nanomatch.de/technical/SimStackRequirements/SingleNodeSlurm.html

https://blog.llandsmeer.com/tech/2020/03/02/slurm-single-instance.html


Thursday, December 22, 2022

Collision Energy

 The kinetic energy between two colliding particles can be expressed in terms of center of mass and relative velocity by

\[ E_k = \frac{1}{2} m_1 v_1^2 + \frac{1}{2} m_2v_2^2 = \frac{1}{2} M v_c^2 + \frac{1}{2} \mu v_r^2 , \]

a sum of a center-of-mass term and a relative momentum term.

where $M$, $v_c$, $\nu$, and $v_r$ are given by

\[ M = (m_1+m_2) ; \]

\[ \mathbf{v_c} = \frac{m_1 \mathbf{v_1} + m_2 \mathbf{v_2}}{m_1 +m_2} ;\]

\[ \mu = \frac{m_1 m_2}{m_1 + m_2} ;\]

\[ \mathbf{v_r} = \mathbf{v_1} - \mathbf{v_2} .\]


$\frac{1}{2} \mu v_r^2$ is called collision energy.

amu is short for atomic mass unitProtons have a positive electrical charge of one (+1) and a mass of 1 atomic mass unit (amu), which is about 1.67×10−27 kilograms.



Reference:

https://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Map%3A_Physical_Chemistry_for_the_Biosciences_(Chang)/02%3A_Properties_of_Gases/2.8%3A_Molecular_Collisions_and_the_Mean_Free_Path

https://web.chem.ox.ac.uk/teaching/Physics%20for%20CHemists/Mechanics/Collisions.html

https://www.angelo.edu/faculty/kboudrea/periodic/structure_mass.htm



Wednesday, December 21, 2022

Adiabatic Cooling

An adiabatic process is one in which no heat enters or leaves the system.


The thermdynamic first law takes the form

\[ dU=-PdV ,\]

since $dQ=0$.

Note that $C_v=(\partial U/ \partial T)_V$ , but the internal energy of an ideal gas depends only on the temperature and is independent of the volume (because there are no intermolecular forces). Thus for an ideal gas, we have

\[ dU=C_v dT = PdV \]

\[ PV= RT=(C_p-C_v)T  \]

\[ \gamma = C_p/C_v \]

Then we have

\[ TV^{\gamma-1}=const  \]
\[ d\ln(T)/dt = -(\gamma-1) \nabla \cdot u\]
where we have use 
\[ \frac{1}{V} \frac{dV}{dt} = \nabla \cdot  u \]
where $u$ is the flow speed.

Since $K_B T \propto E$, here $E$ is thermal energy. We have 
\[ d\ln(E)/dt = -(\gamma-1) \nabla \cdot u \]

For non-relativistic particle, $\gamma=5/3$, $E=p^2/m$.
For relativistic particle, $\gamma=4/3$, $E=pc$,
we have 
\[ \frac{dp}{dt} = -\frac{p}{3} \nabla \cdot u \]

The bulk of particles lose energy by adiabatic cooling due to the work that protons exert on the expanding material. Particles (pressure ?) do (positive) work on the expanding medium cause their bulk energy reduce.


Reference:

https://github.com/bolverk/theoretical_physics_digest