// File: 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
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x400(%rbp)
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x270, %rdi            # imm = 0x270
callq 0x2f720
cmpq $0x0, %rax
jne 0x109a72
leaq -0x28(%rbp), %rdi
callq 0x2f880
leaq -0x48(%rbp), %rdi
callq 0x2f880
leaq -0x68(%rbp), %rdi
callq 0x2f880
leaq -0x89(%rbp), %rdi
movq %rdi, -0x408(%rbp)
callq 0x30a70
movq -0x408(%rbp), %rdx
leaq 0xd91bc(%rip), %rsi     # 0x1e24ff
leaq -0x88(%rbp), %rdi
callq 0x44470
jmp 0x109351
leaq -0x88(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x17e2d0
jmp 0x109363
leaq -0x88(%rbp), %rdi
callq 0x311e8
leaq -0x89(%rbp), %rdi
callq 0x311c0
leaq -0x28(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
jbe 0x109405
movq -0x400(%rbp), %rdi
addq $0x1730, %rdi           # imm = 0x1730
leaq 0xcb455(%rip), %rsi     # 0x1d47f4
callq 0x2f9d0
jmp 0x1093a6
jmp 0x109a32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x1093dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x311e8
leaq -0x89(%rbp), %rdi
callq 0x311c0
jmp 0x109a52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109a52
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x410(%rbp)
callq 0x30a70
movq -0x410(%rbp), %rdx
leaq 0xd90e4(%rip), %rsi     # 0x1e250a
leaq -0xc0(%rbp), %rdi
callq 0x44470
jmp 0x109434
leaq -0xc0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x17e2d0
jmp 0x109446
leaq -0xc0(%rbp), %rdi
callq 0x311e8
leaq -0xc1(%rbp), %rdi
callq 0x311c0
leaq -0x28(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
jbe 0x109908
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x418(%rbp)
callq 0x30a70
movq -0x418(%rbp), %rdx
leaq 0xd9083(%rip), %rsi     # 0x1e2515
leaq -0xe8(%rbp), %rdi
callq 0x44470
jmp 0x1094a0
leaq -0xe8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x17e2d0
jmp 0x1094b2
leaq -0xe8(%rbp), %rdi
callq 0x311e8
leaq -0xe9(%rbp), %rdi
callq 0x311c0
leaq -0x111(%rbp), %rdi
movq %rdi, -0x420(%rbp)
callq 0x30a70
movq -0x420(%rbp), %rdx
leaq 0xd9035(%rip), %rsi     # 0x1e2520
leaq -0x110(%rbp), %rdi
callq 0x44470
jmp 0x1094f9
leaq -0x110(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x17e2d0
jmp 0x10950b
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0x111(%rbp), %rdi
callq 0x311c0
leaq -0x28(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
ja 0x109545
leaq -0x48(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
jbe 0x10962f
movq -0x400(%rbp), %rdi
addq $0x1730, %rdi           # imm = 0x1730
leaq 0xcb2a0(%rip), %rsi     # 0x1d47fa
callq 0x2f9d0
jmp 0x109561
jmp 0x109903
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109598
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x311e8
leaq -0xc1(%rbp), %rdi
callq 0x311c0
jmp 0x109a52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x1095db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x311e8
leaq -0xe9(%rbp), %rdi
callq 0x311c0
jmp 0x109a52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x10961e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x311e8
leaq -0x111(%rbp), %rdi
callq 0x311c0
jmp 0x109a52
leaq -0x138(%rbp), %rdi
callq 0x2f880
leaq -0x159(%rbp), %rdi
movq %rdi, -0x428(%rbp)
callq 0x30a70
movq -0x428(%rbp), %rdx
leaq 0xd8ecf(%rip), %rsi     # 0x1e252b
leaq -0x158(%rbp), %rdi
callq 0x44470
jmp 0x10966a
leaq -0x158(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x17e2d0
jmp 0x10967c
leaq -0x158(%rbp), %rdi
callq 0x311e8
leaq -0x159(%rbp), %rdi
callq 0x311c0
leaq -0x181(%rbp), %rdi
movq %rdi, -0x430(%rbp)
callq 0x30a70
movq -0x430(%rbp), %rdx
leaq 0xd8e86(%rip), %rsi     # 0x1e253b
leaq -0x180(%rbp), %rdi
callq 0x44470
jmp 0x1096c3
leaq -0x180(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x17e2d0
jmp 0x1096d5
leaq -0x180(%rbp), %rdi
callq 0x311e8
leaq -0x181(%rbp), %rdi
callq 0x311c0
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x438(%rbp)
callq 0x30a70
movq -0x438(%rbp), %rdx
leaq 0xd8e39(%rip), %rsi     # 0x1e2547
leaq -0x1a8(%rbp), %rdi
callq 0x44470
jmp 0x10971c
leaq -0x1a8(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x17e2d0
jmp 0x109731
leaq -0x1a8(%rbp), %rdi
callq 0x311e8
leaq -0x1a9(%rbp), %rdi
callq 0x311c0
leaq -0x28(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
ja 0x10977d
leaq -0x48(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
ja 0x10977d
leaq -0x138(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
jbe 0x1098e4
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x440(%rbp)
callq 0x30a70
movq -0x440(%rbp), %rdx
leaq 0xd8db4(%rip), %rsi     # 0x1e2552
leaq -0x1d0(%rbp), %rdi
callq 0x44470
jmp 0x1097ac
movq -0x400(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0xeada0
jmp 0x1097c1
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
leaq -0x1d1(%rbp), %rdi
callq 0x311c0
jmp 0x1098e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109810
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x311e8
leaq -0x159(%rbp), %rdi
callq 0x311c0
jmp 0x1098f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109853
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x311e8
leaq -0x181(%rbp), %rdi
callq 0x311c0
jmp 0x1098f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109896
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x311e8
leaq -0x1a9(%rbp), %rdi
callq 0x311c0
jmp 0x1098f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x1098d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x311e8
leaq -0x1d1(%rbp), %rdi
callq 0x311c0
jmp 0x1098f2
leaq -0x138(%rbp), %rdi
callq 0x311e8
jmp 0x109903
leaq -0x138(%rbp), %rdi
callq 0x311e8
jmp 0x109a52
jmp 0x109a30
leaq -0x28(%rbp), %rdi
callq 0x2fe00
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x30a70
movq -0x448(%rbp), %rdx
leaq 0xd8cda(%rip), %rsi     # 0x1e260c
leaq -0x1f8(%rbp), %rdi
callq 0x44470
jmp 0x109940
leaq -0x1f8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x17e2d0
jmp 0x109952
leaq -0x1f8(%rbp), %rdi
callq 0x311e8
leaq -0x1f9(%rbp), %rdi
callq 0x311c0
leaq -0x28(%rbp), %rdi
callq 0x2ff30
cmpq $0x0, %rax
jbe 0x109a2e
movq -0x400(%rbp), %rdi
addq $0x1730, %rdi           # imm = 0x1730
leaq 0xcae73(%rip), %rsi     # 0x1d4805
callq 0x2f9d0
jmp 0x109999
movq -0x400(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x300, %rdi            # imm = 0x300
callq 0x2f720
cmpq $0x0, %rax
ja 0x109a2c
movq 0x1cb590(%rip), %rdi    # 0x2d4f50
leaq 0xd8c52(%rip), %rsi     # 0x1e2619
callq 0x2ff50
movq %rax, -0x450(%rbp)
jmp 0x1099d5
movq -0x450(%rbp), %rdi
movq 0x1cb5e5(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0x1099ea
jmp 0x109a2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109a1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x311e8
leaq -0x1f9(%rbp), %rdi
callq 0x311c0
jmp 0x109a52
jmp 0x109a2e
jmp 0x109a30
jmp 0x109a32
leaq -0x68(%rbp), %rdi
callq 0x311e8
leaq -0x48(%rbp), %rdi
callq 0x311e8
leaq -0x28(%rbp), %rdi
callq 0x311e8
jmp 0x109bbd
leaq -0x68(%rbp), %rdi
callq 0x311e8
leaq -0x48(%rbp), %rdi
callq 0x311e8
leaq -0x28(%rbp), %rdi
callq 0x311e8
jmp 0x109e49
movq -0x400(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x270, %rdi            # imm = 0x270
leaq 0xcad66(%rip), %rsi     # 0x1d47f4
callq 0x45af0
testb $0x1, %al
jne 0x109a9c
jmp 0x109bbb
movq -0x400(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x270, %rdi            # imm = 0x270
leaq 0xcad42(%rip), %rsi     # 0x1d47fa
callq 0x45af0
testb $0x1, %al
jne 0x109ac6
jmp 0x109bbb
movq -0x400(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x270, %rdi            # imm = 0x270
leaq 0xcad23(%rip), %rsi     # 0x1d4805
callq 0x45af0
testb $0x1, %al
jne 0x109af0
jmp 0x109bbb
movq -0x400(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x270, %rdi            # imm = 0x270
leaq 0xcacf5(%rip), %rsi     # 0x1d4801
callq 0x45af0
testb $0x1, %al
jne 0x109b1a
jmp 0x109bbb
leaq -0x221(%rbp), %rdi
movq %rdi, -0x458(%rbp)
callq 0x30a70
movq -0x458(%rbp), %rdx
leaq 0xd8b30(%rip), %rsi     # 0x1e266b
leaq -0x220(%rbp), %rdi
callq 0x44470
jmp 0x109b49
movq -0x400(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0xeada0
jmp 0x109b5e
leaq -0x220(%rbp), %rdi
callq 0x311e8
leaq -0x221(%rbp), %rdi
callq 0x311c0
jmp 0x109bbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109baa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x311e8
leaq -0x221(%rbp), %rdi
callq 0x311c0
jmp 0x109e49
jmp 0x109bbd
movq -0x400(%rbp), %rdi
addq $0x14c0, %rdi           # imm = 0x14C0
addq $0x270, %rdi            # imm = 0x270
callq 0x2f720
cmpq $0x0, %rax
jne 0x109e40
leaq -0x248(%rbp), %rdi
callq 0x2f880
leaq -0x268(%rbp), %rdi
callq 0x2f880
jmp 0x109bfb
movq 0x1cb34e(%rip), %rdi    # 0x2d4f50
leaq 0xd8adc(%rip), %rsi     # 0x1e26e5
callq 0x2ff50
movq %rax, -0x460(%rbp)
jmp 0x109c17
movq -0x460(%rbp), %rdi
movq 0x1cb3a3(%rip), %rsi    # 0x2d4fc8
callq 0x30c10
jmp 0x109c2c
movq 0x1cb385(%rip), %rdi    # 0x2d4fb8
leaq -0x248(%rbp), %rsi
callq 0x2fcb0
jmp 0x109c41
movl $0x10, %edi
movl $0x8, %esi
callq 0x122610
movl %eax, -0x464(%rbp)
jmp 0x109c58
movl -0x464(%rbp), %edx
leaq -0x3f0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x31190
jmp 0x109c73
leaq -0x3f0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x2fae0
jmp 0x109c88
leaq 0xd0e52(%rip), %rsi     # 0x1daae1
leaq -0x268(%rbp), %rdi
callq 0x44930
movb %al, -0x465(%rbp)
jmp 0x109ca3
movb -0x465(%rbp), %al
testb $0x1, %al
jne 0x109cd6
jmp 0x109caf
leaq 0x1075d7(%rip), %rsi    # 0x21128d
leaq -0x268(%rbp), %rdi
callq 0x44930
movb %al, -0x466(%rbp)
jmp 0x109cca
movb -0x466(%rbp), %al
testb $0x1, %al
jne 0x109cd6
jmp 0x109d3b
movq -0x400(%rbp), %rdi
addq $0x1730, %rdi           # imm = 0x1730
leaq 0xcab09(%rip), %rsi     # 0x1d47f4
callq 0x2f9d0
jmp 0x109cf2
movl $0x3, -0x3f4(%rbp)
jmp 0x109ded
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x109e26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x2f940
jmp 0x109e26
leaq 0xcbd86(%rip), %rsi     # 0x1d5ac8
leaq -0x268(%rbp), %rdi
callq 0x44930
movb %al, -0x467(%rbp)
jmp 0x109d56
movb -0x467(%rbp), %al
testb $0x1, %al
jne 0x109d89
jmp 0x109d62
leaq 0x1076fa(%rip), %rsi    # 0x211463
leaq -0x268(%rbp), %rdi
callq 0x44930
movb %al, -0x468(%rbp)
jmp 0x109d7d
movb -0x468(%rbp), %al
testb $0x1, %al
jne 0x109d89
jmp 0x109db1
movq -0x400(%rbp), %rdi
addq $0x1730, %rdi           # imm = 0x1730
leaq 0xcaa5c(%rip), %rsi     # 0x1d47fa
callq 0x2f9d0
jmp 0x109da5
movl $0x3, -0x3f4(%rbp)
jmp 0x109ded
jmp 0x109db3
movq -0x400(%rbp), %rdi
addq $0x14e0, %rdi           # imm = 0x14E0
leaq 0x107733(%rip), %rsi    # 0x2114fb
callq 0x44930
movb %al, -0x469(%rbp)
jmp 0x109dd5
movb -0x469(%rbp), %al
testb $0x1, %al
jne 0x109de1
jmp 0x109de3
jmp 0x109de3
movl $0x0, -0x3f4(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x2f940
movl -0x3f4(%rbp), %eax
testl %eax, %eax
je 0x109e07
jmp 0x109e05
jmp 0x109e0c
jmp 0x109bf9
leaq -0x268(%rbp), %rdi
callq 0x311e8
leaq -0x248(%rbp), %rdi
callq 0x311e8
jmp 0x109e40
leaq -0x268(%rbp), %rdi
callq 0x311e8
leaq -0x248(%rbp), %rdi
callq 0x311e8
jmp 0x109e49
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x30170
nopw %cs:(%rax,%rax)