03-27-2017 03:05 PM
I am running simulation in batch mode from SAS EG , sometimes when the simulation is called in batch mode the command prompt never closes (that pops up when simulation is running) . This happens once a while and i am not able to automate the entire process. Any idea why would this happen?
03-27-2017 03:15 PM
Have you examined logs? You may want to consider direting logs to a file, Proc Printto, so that intermediate results are captured.
One would suspect something about the data setup not working with the desired simulation but details are completely lacking. What kind of simulation, types/numer of parameters or variables, size of data set(s) ...
03-27-2017 03:22 PM
As per the logs on the command prompt, there are no errors. SImulation is a G/M/1 queing model and each run involves approx 40 data sets with max 50 observations and 10 varaibles. These datasets are in work library and i clean the work library between iterations so that there is no overloading. By iterations i mean i run the simulation with different mean of r.v X ~ G with utilization always less than 1 with finite time termination criteria. eg. T = 50000
03-28-2017 03:42 AM
Have you tried to run the batch outside of Enterprise Guide to see if it is related to Simulation Studio batch or calling it from EG? If you put your batch command in a .bat file and execute it from there you should see the same behaviour with the window not closing down after completion if it is sim batch related. If you cannot replicate the behaviour using the stand alone .bat file - and since you are looking to automate the process - you might consider moving the entire process out of EG and into a batch process in the .bat file. You could call SAS programs derived from your EG project from within the .bat file just like you would the simulation batch. And if you need to be able to create variations of the batch process, you could have a SAS program (or an EG project) write the .bat file which in turn could be executed.
Do post more details if the issue persists.
03-29-2017 03:16 PM
i have called the program from SAS Base also and still i have the same problem. The problem does not happen all the time. Once in a file it get stuck and is creating a .bat file same as running the sas program file in batch mode? I tried that approach also.
03-29-2017 08:45 PM
/*Assing root path*/ %let root = C:\Users\Desktop\Research\SASsim\load_based_singleproduct_cf; option spool; %let revenue=60; %let backlog=50; %let wipcost=35; %let inventory=15; %let materialcost=3; /*Initialize some macro varaibles*/ %let nbreplications = 20; /*Simulation path and model path */ %let SimStudioPath=C:\Program Files\SASHome\SASSimulationStudio\14.1; %let sim_path= C:\Simulation_Models\Exponential_System; /*Assigning Libraries */ libname CF_Load "&root\Input"; libname siminput "&root\Solution\Iterations"; %inc "&root\code\CostCalculation.sas"; data _null_; file "&&sim_path\experiment0.simexp"; nbreplications=&nbreplications; put ' <?xml version="1.0" encoding="UTF-8"?> <design_matrix> <defaults end_time="Infinity" replication_count="1" start_time="0.0"/> <point end_time="37440.0" name="point 1" replication_count="' nbreplications+(-1)'" start_time="0.0"/> </design_matrix> '; run; %macro Allcases; %do cases=2 %to 4; libname CF_L_sol "&root\Solution\Case\Case&cases"; /*Initialize demand to be the releases for the first iteration and intial parameter values*/ data CF_L_sol.Release0; set CF_Load.demand; run; data CF_L_sol.Parameter0; _SSE_ = &Bound; theta1 = 94; theta2 = 25; run; data CF_L_sol.log; format OptStartTime datetime.; OptStartTime= datetime(); run; %global failure System; %macro Case; %if &cases=1 %then %do; %let failure = 0; %let System = 1; %put &failure; %put &System; %end; %if &cases=2 %then %do; %let failure = 1; %let System = 1; %put &failure; %put &System; %end; %if &cases=3 %then %do; %let failure = 0; %let System = 2; %put &failure; %put &System; %end; %if &cases=4 %then %do; %let failure = 1; %let System = 2; %put &failure; %put &System; %end; %mend; %case /* Call simulation in a batch mode */ %inc "&root\code\IterativeCF.sas"; data CF_L_sol.log; format SimEndTime datetime.; format SimTimeSpent MMSS.; set CF_L_sol.log; SimEndTime = datetime(); SimTimeSpent=SimEndTime-SimStartTime; run; %end; %mend; %Allcases proc printto ; run; %put "****** Program Run Ended*****";
The code is attched. The file IterativeCF.sas has code that calls simulation in batch mode. Is there anything wrong with the the code that would make the command prompt to freeze on occasions? .
Note: The issue happens randomly. I am trying to figure out whats wrong.
Any help is appreciated.
03-31-2017 02:30 AM
I cannot see anything wrong with that code. On the contrary. It's an elegant implemetation.
When you say the issue happens randomly, is this true for any of the 'cases' iteration? I suppose the way forward is to try and figure out if the randomness is really random or if there is a pattern to it. One idea, if you haven't already tired it, is to solve the simulation for one case only, but wrap it in an outer loop to repeat the same simulation several times (e.g. 100 depending on the run times). This should help you isolate the issue to either infrastructure, in case stalling is still random, or problem formulation, if the stalling only happens for one or some cases. If the later you'll also have a better indication of where to dig further to identify the real issue.
04-03-2017 07:17 PM
I tried by cases but it runs fine. This is the screen shot of the frozen command prompt. I cannot figure out what is wrong by looking at this.
04-04-2017 04:36 PM
The batch run probably hangs because it encouters an error in the model. In my experience, the java.lang.NullPointerException message occurs when you have a pointer to a SAS dataset record that exceeds the number of rows in the dataset. Or, if by some other reason, the input dataset to your model is empty, and thus any reference to a record in it is invalid. Could this be a reason that your loops somehow create an empty dataset you use in the model?
My take is that it is not an issue with the batch run. Is it possible for you to run an experiement where you run each case iteration interactively with SimStudio open? That way you might be able to identify the block where the error occurs and possibly determine what the issue is
04-05-2017 02:53 PM
I agree with the previous response. There is an error in the simulation model that is causing the batch run to hang. I also suggest running the model interactively to try to pin point where the error in the model is occuring. From the attached error message, it looks like it has something to do with the resource scheduler entity and possibly how its attributes are set.
04-05-2017 08:03 PM
04-06-2017 09:34 AM
I looked at your model, and as far as I can tell, everything looks fine (I did have to modify your project file to open it though because it was trying to open model2_0, which was not there. I opened model2_1). I ran your model for 50 replications in parallel with no problems.
I went back and looked at the attached image of the java error. I am thinking now that this is not related to your resource scheduler. The first event processed in your model when it starts is the resource scheduler, which is why we see messages relating to it. But I also see a warning before that about the windows registry. Something seems to be preventing the model run from starting normally. Could you possibly have some sort of permissions issue? Are you sure your input data sets are being generated and accessed correctly in the Sim Studio model? In the version of the model that you are running, are there other input data sets, other than the one that sets the batch size for the entity generator?
I will look into the windows registry warning further.
One last thing to try...try adding the -nonparallel option to your batch run command.
04-06-2017 10:17 AM
One other thing to try...run as administrator once. That should create an entry in the registry that seems to be missing right now.
04-07-2017 12:27 PM
I tried both the approach, running in nonparallel mode and running as administrator (granted access to sasHome directory) and still facing the same problem.
04-07-2017 02:08 PM
Ok, I checked with tech support about the windows registry warning message. Here is additional info from them. If you continue to have problems, I suggest contacting tech support directly:
Based on the warning message showing in the log, the system is having problems opening the windows registry key below on the machine:
You may need to verify that this registry key does exist on the machine, or if it does not exist , you
may need to try manually creating the key and then attempt the batch mode submission again.
You will likely need the assistance of an IT staff person who has administrative level permissions to check the
windows registry settings on the machine, and to create the key if necessary.
Depending upon whether you are on 32-bit or 64-bit windows, the keys will be as follows:
32 bit Windows
64 bit Windows
Be sure you are doing your batch mode submission using “run as administrator” , if you are running from a batch script file.