{"id":1872,"date":"2020-07-06T13:41:36","date_gmt":"2020-07-06T17:41:36","guid":{"rendered":"https:\/\/www.bu.edu\/engit\/?page_id=1872"},"modified":"2025-12-10T08:59:32","modified_gmt":"2025-12-10T13:59:32","slug":"batchcomsol","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/engit\/knowledge-base\/grid\/software\/batchcomsol\/","title":{"rendered":"Running Batch COMSOL Jobs"},"content":{"rendered":"<p style=\"margin-top: 22pt; margin-bottom: 0pt; font-family: Calibri; font-size: 18.0pt;\"><span style=\"font-weight: bold;\">On the Shared Computing Cluster (SCC)<\/span><\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">Load the engineering Modules so paths work similarly to the engineering gird.<\/p>\n<div style=\"direction: ltr;\">\n<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" valign=\"top\" style=\"direction: ltr; border-collapse: collapse; border: 1pt solid #A3A3A3;\" title=\"\" summary=\"\">\n<tbody>\n<tr>\n<td style=\"background-color: #f2f2f2; vertical-align: top; width: 6.084in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: 'Courier New'; font-size: 11.0pt;\"><span style=\"background: #F3F5F7;\">[scc2 ~]$ source \/ad\/eng\/bin\/engenv.sh<br \/>\n[scc2 ~]$ module load comsol\/6.2<br \/>\n[scc2 ~]$ which comsol<br \/>\n\/ad\/eng\/opt\/comsol62\/bin\/comsol<br \/>\ncomsol<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-family: Calibri; font-size: 11pt;\">By default COMSOL will use all available CPU cores on a computer, and on the SCC some cores might be in use by other jobs. To make sure usage is balanced properly, use the parallel environment called &#8220;threaded&#8221; to request a specific number of cores. Also, COMSOL won&#8217;t run without access to your home directory (even for jobs that don&#8217;t actually access it) so we need to manually push your credentials across a queue before starting the job. (This step should last ten hours, once it&#8217;s run.)<\/span><\/p>\n<\/div>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">For example, this command will request 4 cores within a single job on that queue:<\/p>\n<div style=\"direction: ltr;\">\n<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" valign=\"top\" style=\"direction: ltr; border-collapse: collapse; border: 1pt solid #A3A3A3;\" title=\"\" summary=\"\">\n<tbody>\n<tr>\n<td style=\"background-color: #f2f2f2; vertical-align: top; width: 6.0055in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: 'Courier New'; font-size: 11.0pt;\"><span style=\"background: #F3F5F7;\">$ qsub -q example.q -pe threaded 4 comsoljob.sh<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">Where inside comsoljob.sh $NSLOTS will automatically have the requested number from qsub:<\/p>\n<div style=\"direction: ltr;\">\n<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" valign=\"top\" style=\"direction: ltr; border-collapse: collapse; border: 1pt solid #A3A3A3;\" title=\"\" summary=\"\">\n<tbody>\n<tr>\n<td style=\"background-color: #f2f2f2; vertical-align: top; width: 6.084in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: 'Courier New'; font-size: 11.0pt;\"><span style=\"background: #F3F5F7;\">#$ -cwd<br \/>\n#$ -pe threaded 4<br \/>\n#$ -N comsol-batchcomsol-research batch -autosave off -np $NSLOTS -inputfile in.mph -outputfile out.mph<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"margin: 0in; font-size: 11.0pt;\"><span style=\"font-family: Calibri;\">(Remember to choose either the research or educational license according to the <\/span><span style=\"font-family: Calibri;\">main COMSOL instructions<\/span><span style=\"font-family: Calibri;\">.) Some queues have more cores per machine available than others, and your job will only run on a computer that has the requested number of cores already free. So, while the job will run slower with fewer cores, it&#8217;ll be more likely to be able to start sooner, with one core (<\/span><span style=\"font-family: 'Courier New';\">comsol\u00a0batch\u00a0-np\u00a01<\/span><span style=\"font-family: Calibri;\">) most likely to launch immediately. <\/span><\/p>\n<p style=\"margin: 0in; font-family: Calibri; font-size: 11.0pt;\">Note that large amounts of data are often included beneath dotfile directories (those that start with a &#8216;.&#8217;) which may just be full of unneeded temporary data. For example, COMSOL stores a lot of state data in <span style=\"font-weight: bold;\">.comsol<\/span>. You can speedup computations and reduce quota related crashes by <a href=\"https:\/\/scicomp.ethz.ch\/wiki\/Comsol_files_in_the_home_directory\">moving the recovery and workspace directories<\/a>. You may also want to read <a href=\"https:\/\/www.comsol.com\/forum\/thread\/12209\/change-the-directory-of-temporary-file\">this<\/a> for other hints.<\/p>\n<div style=\"direction: ltr;\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>On the Shared Computing Cluster (SCC) Load the engineering Modules so paths work similarly to the engineering gird. [scc2 ~]$ source \/ad\/eng\/bin\/engenv.sh [scc2 ~]$ module load comsol\/6.2 [scc2 ~]$ which comsol \/ad\/eng\/opt\/comsol62\/bin\/comsol comsol By default COMSOL will use all available CPU cores on a computer, and on the SCC some cores might be in use [&hellip;]<\/p>\n","protected":false},"author":1470,"featured_media":0,"parent":138,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/pages\/1872"}],"collection":[{"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/users\/1470"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/comments?post=1872"}],"version-history":[{"count":6,"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/pages\/1872\/revisions"}],"predecessor-version":[{"id":2960,"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/pages\/1872\/revisions\/2960"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/pages\/138"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/engit\/wp-json\/wp\/v2\/media?parent=1872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}