// File: /workspace/github_cpp_makefile_star2_O2/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::getClusterInformation()
void Swarm::getClusterInformation() {

	// If user didn't specify cluster platform, let's figure it out ourself
	if (options.clusterSoftware.size() == 0) {
		// Test for slurm
		string output;
		string output2;
		string output3;

		runCommand("which srun", output);
		if (output.length() > 0) {
			options.clusterSoftware = "slurm";
		}
		// Test for PBS-type
		else{
			runCommand("which qsub", output);
			if(output.length() > 0) {
				// Test for Torque/PBS
				runCommand("which maui", output);
				runCommand("which moab", output2);
				if(output.length() > 0 || output2.length() > 0) {
					options.clusterSoftware = "torque";
				}
				// Test for SGE
				else {
					string output3;
					runCommand("which sge_execd", output);
					runCommand("which qconf", output2);
					runCommand("which qmon", output3);
					if (output.length() > 0 || output2.length() > 0 || output3.length() > 0) {
						outputError("Error: BioNetFit doesn't support GridEngine clusters. If you are not running on a GridEngine cluster, specify the cluster platform in the .conf file using the 'cluster_software' option.");
					}
				}
			}
			// Test for mpi
			else {
				output.clear();
				runCommand("which mpirun", output);

				if (output.length() > 0) {
					options.clusterSoftware = "mpi";

					if (options.hostfile.size() <= 0) {
						cout << "Warning: You are using mpi, but failed to specify a hostfile in your .conf file.." << endl;
					}
				}
			}
		}
	}
	else {
		if (options.clusterSoftware != "slurm" && options.clusterSoftware != "torque" && options.clusterSoftware != "mpi" && options.clusterSoftware != "BNF2mpi") {
			outputError("You specified an unrecognized cluster type in your .conf file. BioNetFit only supports 'torque' or 'slurm' cluster types.");
		}
	}

	// If we still don't know the cluster type, let's ask the user.
	if (options.clusterSoftware.size() == 0) {
		string input;
		string clusterType;

		while (1) {
			cout << "BioNetFit couldn't determine which type of cluster software you are using. Specify (T) for Torque, or (S) for Slurm" << endl;
			getline(cin, input);
			stringstream myInp(input);
			myInp >> clusterType;
			
			if (clusterType == "S" || clusterType == "s") {
				options.clusterSoftware = "slurm";
				break;
			}
			else if (clusterType == "T" || clusterType == "t") {
				options.clusterSoftware = "torque";
				break;
			}
			
			
			if (options.fitType == "de") {
			//	processParamsDE(paramsVec, subParID, fitCalc);
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x338, %rsp            # imm = 0x338
movq %rdi, %rbx
leaq 0x1730(%rdi), %r14
cmpq $0x0, 0x1738(%rdi)
je 0x7b665
leaq 0x54ddb(%rip), %rsi     # 0xd03bf
movq %r14, %rdi
callq 0x33990
testb %al, %al
je 0x7b714
leaq 0x54dca(%rip), %rsi     # 0xd03c5
movq %r14, %rdi
callq 0x33990
testb %al, %al
je 0x7b714
leaq 0x54dbe(%rip), %rsi     # 0xd03d0
movq %r14, %rdi
callq 0x33990
testb %al, %al
je 0x7b714
leaq 0x54da3(%rip), %rsi     # 0xd03cc
movq %r14, %rdi
callq 0x33990
testb %al, %al
je 0x7b714
leaq 0x6261c(%rip), %rsi     # 0xddc5c
leaq 0x170(%rsp), %rdi
leaq 0x1b0(%rsp), %rdx
callq 0x33402
leaq 0x170(%rsp), %rsi
movq %rbx, %rdi
callq 0x6aed2
leaq 0x1c0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
leaq 0x18(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x6244f(%rip), %rsi     # 0xddaf0
leaq 0x150(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x33402
leaq 0x150(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x9f499
leaq 0x150(%rsp), %rdi
callq 0x295a0
cmpq $0x0, 0x1b8(%rsp)
je 0x7b860
leaq 0x54cd4(%rip), %rsi     # 0xd03bf
movq %r14, %rdi
callq 0x29490
leaq 0x50(%rsp), %rdi
callq 0x295a0
leaq 0x8(%rsp), %rdi
callq 0x295a0
leaq 0x1b0(%rsp), %rdi
callq 0x295a0
cmpq $0x0, 0x1738(%rbx)
jne 0x7b84e
movq %r14, 0x48(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
addq $0x14e0, %rbx           # imm = 0x14E0
leaq 0x8(%rsp), %r14
leaq 0x1b0(%rsp), %r15
leaq 0x50(%rsp), %r12
leaq 0x5aa58(%rip), %r13     # 0xd61c1
leaq 0x90a7d(%rip), %rbp     # 0x10c1ed
movq 0xea821(%rip), %rdi     # 0x165f98
leaq 0x62558(%rip), %rsi     # 0xddcd6
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
movq 0xea83e(%rip), %rdi     # 0x165fd0
movq %r14, %rsi
callq 0x28180
movq %r15, %rdi
movq %r14, %rsi
pushq $0x18
popq %rdx
callq 0x290a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x28ce0
movq %r12, %rdi
movq %r13, %rsi
callq 0x3357b
testb %al, %al
jne 0x7b813
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3357b
testb %al, %al
jne 0x7b813
movq %r12, %rdi
leaq 0x55e64(%rip), %rsi     # 0xd163f
callq 0x3357b
testb %al, %al
jne 0x7b81c
movq %r12, %rdi
leaq 0x90bd5(%rip), %rsi     # 0x10c3c3
callq 0x3357b
testb %al, %al
jne 0x7b81c
movq %rbx, %rdi
leaq 0x90c5a(%rip), %rsi     # 0x10c45b
callq 0x3357b
movq %r15, %rdi
callq 0x28790
jmp 0x7b770
leaq 0x54ba5(%rip), %rsi     # 0xd03bf
jmp 0x7b823
leaq 0x54ba2(%rip), %rsi     # 0xd03c5
movq 0x48(%rsp), %rdi
callq 0x29490
leaq 0x1b0(%rsp), %rdi
callq 0x28790
leaq 0x50(%rsp), %rdi
callq 0x295a0
leaq 0x8(%rsp), %rdi
callq 0x295a0
addq $0x338, %rsp            # imm = 0x338
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x62294(%rip), %rsi     # 0xddafb
leaq 0x130(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x33402
leaq 0x130(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x9f499
leaq 0x130(%rsp), %rdi
callq 0x295a0
cmpq $0x0, 0x1b8(%rsp)
je 0x7ba22
leaq 0x62255(%rip), %rsi     # 0xddb06
leaq 0x110(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x33402
leaq 0x110(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x9f499
leaq 0x110(%rsp), %rdi
callq 0x295a0
leaq 0x62225(%rip), %rsi     # 0xddb11
leaq 0xf0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x33402
leaq 0xf0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f499
leaq 0xf0(%rsp), %rdi
callq 0x295a0
movq 0x10(%rsp), %rax
orq 0x1b8(%rsp), %rax
jne 0x7baab
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x621d4(%rip), %rsi     # 0xddb1c
leaq 0xd0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0xd0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x9f499
leaq 0xd0(%rsp), %rdi
callq 0x295a0
leaq 0x621a9(%rip), %rsi     # 0xddb2c
leaq 0xb0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0xb0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x9f499
leaq 0xb0(%rsp), %rdi
callq 0x295a0
leaq 0x6217d(%rip), %rsi     # 0xddb38
leaq 0x90(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x90(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x9f499
leaq 0x90(%rsp), %rdi
callq 0x295a0
cmpq $0x0, 0x1b8(%rsp)
jne 0x7bab7
cmpq $0x0, 0x10(%rsp)
jne 0x7bab7
cmpq $0x0, 0x30(%rsp)
jne 0x7bab7
leaq 0x28(%rsp), %rdi
callq 0x295a0
jmp 0x7b6f3
movq 0x1b0(%rsp), %rax
movb $0x0, (%rax)
leaq 0x621c9(%rip), %rsi     # 0xddbfd
leaq 0x70(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x33402
leaq 0x70(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x9f499
leaq 0x70(%rsp), %rdi
callq 0x295a0
cmpq $0x0, 0x1b8(%rsp)
je 0x7b6f3
leaq 0x5495b(%rip), %rsi     # 0xd03d0
movq %r14, %rdi
callq 0x29490
cmpq $0x0, 0x17c8(%rbx)
jne 0x7b6f3
movq 0xea506(%rip), %rdi     # 0x165f98
leaq 0x62171(%rip), %rsi     # 0xddc0a
callq 0x289f0
movq %rax, %rdi
callq 0x284a0
jmp 0x7b6f3
leaq 0x54913(%rip), %rsi     # 0xd03c5
jmp 0x7b6eb
leaq 0x62085(%rip), %rsi     # 0xddb43
leaq 0x190(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x33402
leaq 0x190(%rsp), %rsi
movq %rbx, %rdi
callq 0x6aed2
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
jmp 0x7bb30
jmp 0x7bb37
movq %rax, %rbx
leaq 0x170(%rsp), %rdi
jmp 0x7bbd7
movq %rax, %rbx
jmp 0x7bbdc
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x7bb30
jmp 0x7bb37
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
jmp 0x7bb30
jmp 0x7bb37
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x295a0
jmp 0x7bb3a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x7bb89
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
jmp 0x7bb89
jmp 0x7bb90
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0x7bb89
jmp 0x7bb90
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
jmp 0x7bb89
jmp 0x7bb90
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
jmp 0x7bb89
jmp 0x7bb90
jmp 0x7bb90
jmp 0x7bbb1
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x295a0
jmp 0x7bb93
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x295a0
leaq 0x8(%rsp), %rdi
callq 0x295a0
leaq 0x1b0(%rsp), %rdi
jmp 0x7bbd7
movq %rax, %rbx
leaq 0x1b0(%rsp), %rdi
callq 0x28790
jmp 0x7bbc8
jmp 0x7bbc5
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x295a0
leaq 0x8(%rsp), %rdi
callq 0x295a0
movq %rbx, %rdi
callq 0x292f0