###################################################################### # Script file: run_benchmark.lsf # Runs simulations with different resource configuration and extract # performance data (simulation time and solver speed). # # Copyright 2022 Ansys, Inc. ###################################################################### # File name for result export file = "benchmark_FDTD"; # Simulation testfile fname = "benchmark_small"; if (fileexists(file+".json")) { jsonload(file); }else{ ?"create data"; out = struct; } # Processor out.CPU = "AMD EPYC 7R32 2.8GHz"; # Number of processes for simulations np = [ 48, 96 ]; # Resource configuration: # For each resource configuration, you can set any property using a # struct with name and "value" field. config = cell(2); config{1} = { "name": "MSMPI", "settings": cell(1) }; config{1}.settings{1} = { "name": "job launching preset", "value": "Remote: Microsoft MPI" }; config{2} = { "name": "IMPI", "settings": cell(1) }; config{2}.settings{1} = { "name": "job launching preset", "value": "Remote: Intel MPI" }; load(fname); for(i=1:length(config)) { ?config{i}.name; data = struct; sim_time = total_speed = solver_speed = matrix(length(np)); for(j=1:length(config{i}.settings)) { setresource("FDTD", 1, config{i}.settings{j}.name, config{i}.settings{j}.value); } for(k=1:length(np)) { ?num2str(np(k))+" processes"; switchtolayout; setresource("FDTD", 1, "processes", np(k)); save(fname+"_"+config{i}.name+"_np"+num2str(np(k))); run; total_speed(k) = getresult("FDTD", "total solver speed"); solver_speed(k) = getresult("FDTD", "solver speed"); t1 = getresult("FDTD", "initialization time"); t2 = getresult("FDTD", "simulation run time"); t3 = getresult("FDTD", "miscellaneous time"); sim_time(k) = t1+t2+t3; } data.nproc = np; data.total_speed = total_speed; data.solver_speed = solver_speed; data.simulation_time = sim_time; out = setfield(out, config{i}.name, data); } jsonsave(file, out);