QvisHostProfileWindow.h 13.6 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2
/*****************************************************************************
*
3
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
hrchilds's avatar
hrchilds committed
4
* Produced at the Lawrence Livermore National Laboratory
5
* LLNL-CODE-442911
hrchilds's avatar
hrchilds committed
6 7
* All rights reserved.
*
8
* This file is  part of VisIt. For  details, see https://visit.llnl.gov/.  The
hrchilds's avatar
hrchilds committed
9 10 11 12 13 14 15 16 17 18
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution  and  use  in  source  and  binary  forms,  with  or  without
* modification, are permitted provided that the following conditions are met:
*
*  - Redistributions of  source code must  retain the above  copyright notice,
*    this list of conditions and the disclaimer below.
*  - Redistributions in binary form must reproduce the above copyright notice,
*    this  list of  conditions  and  the  disclaimer (as noted below)  in  the
19 20 21
*    documentation and/or other materials provided with the distribution.
*  - Neither the name of  the LLNS/LLNL nor the names of  its contributors may
*    be used to endorse or promote products derived from this software without
hrchilds's avatar
hrchilds committed
22 23 24 25 26
*    specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR  IMPLIED WARRANTIES, INCLUDING,  BUT NOT  LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE
27 28 29
* ARE  DISCLAIMED. IN  NO EVENT  SHALL LAWRENCE  LIVERMORE NATIONAL  SECURITY,
* LLC, THE  U.S.  DEPARTMENT OF  ENERGY  OR  CONTRIBUTORS BE  LIABLE  FOR  ANY
* DIRECT,  INDIRECT,   INCIDENTAL,   SPECIAL,   EXEMPLARY,  OR   CONSEQUENTIAL
hrchilds's avatar
hrchilds committed
30 31 32 33 34 35 36 37 38
* DAMAGES (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF  SUBSTITUTE GOODS OR
* SERVICES; LOSS OF  USE, DATA, OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER
* CAUSED  AND  ON  ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT
* LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY  WAY
* OUT OF THE  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/

hrchilds's avatar
hrchilds committed
39 40 41 42
#ifndef QVIS_HOST_PROFILE_WINDOW_H
#define QVIS_HOST_PROFILE_WINDOW_H
#include <gui_exports.h>
#include <QvisPostableWindowObserver.h>
whitlocb's avatar
whitlocb committed
43
#include <QMap>
44
#include <QModelIndex>
hrchilds's avatar
hrchilds committed
45 46 47

// Forward declrations
class HostProfileList;
48 49
class MachineProfile;
class LaunchProfile;
hrchilds's avatar
hrchilds committed
50 51 52 53 54 55 56 57
class QPushButton;
class QLabel;
class QLineEdit;
class QSpinBox;
class QGroupBox;
class QLabel;
class QComboBox;
class QTabWidget;
whitlocb's avatar
whitlocb committed
58 59
class QListWidget;
class QListWidgetItem;
hrchilds's avatar
hrchilds committed
60 61 62
class QCheckBox;
class QButtonGroup;
class QRadioButton;
63 64 65
class QNetworkReply;
class QTreeWidget;
class QNetworkAccessManager;
hrchilds's avatar
hrchilds committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114

// ****************************************************************************
//  Class: QvisHostProfileWindow
//
//  Purpose:
//    This window manages the host profiles that are used to launch
//    remote VisIt engines.
//
//  Notes:      
//
//  Programmer: Brad Whitlock
//  Creation:   Tue Sep 19 18:06:49 PST 2000
//
//  Modifications:
//    Brad Whitlock, Wed May 2 11:41:28 PDT 2001
//    Made it postable by switching the class from which it inherits.
//
//    Jeremy Meredith, Tue Jul 17 17:42:07 PDT 2001
//    Added numNodes, launchMethod, and partitionName, as well as checkboxes
//    for each.  Also reworded "default profile" to be "active profile".
//
//    Jeremy Meredith, Fri Sep 21 14:29:59 PDT 2001
//    Added buttons for forcing static and dynamic load balancing.
//
//    Brad Whitlock, Mon Sep 24 09:22:24 PDT 2001
//    Added the internal Apply, ReplaceLocalHost methods.
//
//    Jeremy Meredith, Thu Feb 14 15:14:32 PST 2002
//    I made hostName a combo box instead of a line edit.
//    I also changed the type of callback for the tab page changed.
//
//    Brad Whitlock, Thu Feb 21 10:16:38 PDT 2002
//    I removed the defaultUserName string.
//
//    Jeremy Meredith, Mon Jul 22 11:38:55 PDT 2002
//    Added bank name.
//
//    Jeremy Meredith, Thu Nov 21 11:28:29 PST 2002
//    Added processProfileNameText.
//
//    Jeremy Meredith, Fri Jan 24 14:43:28 PST 2003
//    Added optional arguments to the parallel launcher.
//
//    Jeremy Meredith, Mon Apr 14 18:25:17 PDT 2003
//    Added host aliases.
//
//    Jeremy Meredith, Mon May 19 12:49:17 PDT 2003
//    Added shareMDServer toggle.
//
hrchilds's avatar
hrchilds committed
115 116 117
//    Jeremy Meredith, Mon Aug 18 13:37:25 PDT 2003
//    Changed processUserNameText to userNameChanged.
//
hrchilds's avatar
hrchilds committed
118 119 120 121 122
//    Jeremy Meredith, Thu Oct  9 15:43:39 PDT 2003
//    Added ability to manually specify a client host name or to have it
//    parsed from the SSH_CLIENT (or related) environment variables.  Added
//    ability to specify an SSH port.
//
hrchilds's avatar
hrchilds committed
123 124 125 126
//    Jeremy Meredith, Thu Sep 15 15:20:55 PDT 2005
//    Added machine file support and the ability to use the VisIt script
//    to set up env variables in parallel.
//
hrchilds's avatar
hrchilds committed
127 128 129
//    Hank Childs, Fri Dec  2 11:01:41 PST 2005
//    Added support for hardware acceleration.
//
hrchilds's avatar
hrchilds committed
130 131 132
//    Eric Brugger, Thu Feb 15 12:10:21 PST 2007
//    Added support for additional sublauncher arguments.
//
133 134 135
//    Jeremy Meredith, Thu May 24 11:05:45 EDT 2007
//    Added support for SSH port tunneling.
//
136 137 138 139 140
//    Brad Whitlock, Tue Jun 5 15:53:20 PST 2007
//    Changed all slot functions for QLineEdit so they modify the host profile
//    as text is typed to avoid losing data when editing multiple profiles
//    and not clicking Apply.
//
141 142 143 144
//    Jeremy Meredith, Thu Jun 28 13:31:38 EDT 2007
//    Have the ssh tunneling option override and disable the client host
//    name determination method.
//
145 146 147
//    Brad Whitlock, Wed Apr  9 10:57:10 PDT 2008
//    QString for caption, shortName.
//
148 149 150
//    Dave Bremer, Wed Apr 16 17:54:14 PDT 2008
//    Added fields for commands to run pre and post the mpi command.
//
whitlocb's avatar
whitlocb committed
151 152 153
//    Cyrus Harrison, Tue Jun 24 11:15:28 PDT 2008
//    Initial Qt4 Port.
//
154 155 156
//    Hank Childs, Thu May  7 19:05:36 PDT 2009
//    Added field for host nickname.
//
157 158 159 160
//    Jeremy Meredith, Thu Feb 18 15:54:11 EST 2010
//    Overhauled window entirely.  Split HostProfile into
//    MachineProfile and LaunchProfile.
//
161 162 163 164
//    Eric Brugger, Tue Apr 19 20:37:15 PDT 2011
//    I added the ability to specify a gateway machine to use to get to the
//    remote host.
//
165 166 167 168
//    Tom Fogal, Fri May  6 18:14:43 MDT 2011
//    New widgets for parallel GPU configuration.
//    Removed deprecated/broken precommand/postcommand settings.
//
169 170 171
//    Brad Whitlock, Wed Aug 15 13:55:13 PDT 2012
//    I added controls to set the ssh command.
//
hrchilds's avatar
hrchilds committed
172 173 174 175 176
// ****************************************************************************

class GUI_API QvisHostProfileWindow : public QvisPostableWindowObserver
{
    Q_OBJECT
177
    friend class DropListWidget; //todo remove this dependency..
hrchilds's avatar
hrchilds committed
178 179
public:
    QvisHostProfileWindow(HostProfileList *profiles, 
180 181
                          const QString &caption = QString::null,
                          const QString &shortName = QString::null,
hrchilds's avatar
hrchilds committed
182 183 184 185 186
                          QvisNotepadArea *notepad = 0);
    virtual ~QvisHostProfileWindow();
    virtual void CreateWindowContents();
private:
    void UpdateWindow(bool doAll);
187 188
    void UpdateMachineProfile();
    void UpdateLaunchProfile();
hrchilds's avatar
hrchilds committed
189
    void UpdateWindowSensitivity();
190
    bool GetCurrentValues();
hrchilds's avatar
hrchilds committed
191 192
    void Apply(bool val = false);
    void ReplaceLocalHost();
193 194 195
    void addRemoteProfile(const QString& inputUrl, const QString& results);
    void ListWidgetDropEvent(QDropEvent * event);
    void addChildren(const QModelIndex& list, QStringList& suffixList, QStringList& globalList);
196
    void selectProfiles(const QModelIndex& index);
hrchilds's avatar
hrchilds committed
197 198 199
private slots:
    void apply();

200 201 202 203 204 205
    void currentHostChanged();
    void currentLaunchChanged();

    void addMachineProfile();
    void delMachineProfile();
    void copyMachineProfile();
206
    void exportMachineProfile();
207 208 209 210 211

    void addLaunchProfile();
    void delLaunchProfile();
    void copyLaunchProfile();
    void makeDefaultLaunchProfile();
212
    void selectProfiles();
213 214
    void retriveLatestProfiles();
    void downloadHosts(QNetworkReply* reply);
215 216 217

    void processProfileNameText(const QString &);
    void processDirectoryText(const QString &);
218 219 220 221 222 223 224
    void processEngineArgumentsText(const QString &);
    void processPartitionNameText(const QString &);
    void processBankNameText(const QString &);
    void processTimeLimitText(const QString &);
    void processMachinefileText(const QString &);
    void processLaunchArgsText(const QString &);
    void processSublaunchArgsText(const QString &);
225 226
    void processSublaunchPreCmdText(const QString &);
    void processSublaunchPostCmdText(const QString &);
hrchilds's avatar
hrchilds committed
227 228 229 230 231 232 233 234 235
    void numProcessorsChanged(int value);
    void timeoutChanged(int value);
    void launchMethodChanged(const QString &method);
    void numNodesChanged(int value);
    void toggleLaunch(bool);
    void toggleNumNodes(bool);
    void togglePartitionName(bool);
    void toggleBankName(bool);
    void toggleTimeLimit(bool);
hrchilds's avatar
hrchilds committed
236
    void toggleMachinefile(bool);
hrchilds's avatar
hrchilds committed
237
    void toggleLaunchArgs(bool);
hrchilds's avatar
hrchilds committed
238
    void toggleSublaunchArgs(bool);
239 240
    void toggleSublaunchPreCmd(bool);
    void toggleSublaunchPostCmd(bool);
hrchilds's avatar
hrchilds committed
241 242
    void toggleParallel(bool);
    void toggleShareMDServer(bool);
hrchilds's avatar
hrchilds committed
243
    void toggleUseVisItScriptForEnv(bool);
hrchilds's avatar
hrchilds committed
244 245 246
    void loadBalancingChanged(int);
    void hostNameChanged(const QString &host);
    void hostAliasesChanged(const QString &host);
247
    void hostNicknameChanged(const QString &host);
hrchilds's avatar
hrchilds committed
248
    void userNameChanged(const QString &username);
hrchilds's avatar
hrchilds committed
249 250
    void toggleSSHPort(bool);
    void sshPortChanged(const QString &port);
251 252
    void toggleSSHCommand(bool);
    void sshCommandChanged(const QString &port);
253 254
    void toggleUseGateway(bool);
    void gatewayHostChanged(const QString &port);
hrchilds's avatar
hrchilds committed
255 256
    void clientHostNameMethodChanged(int);
    void clientHostNameChanged(const QString &);
hrchilds's avatar
hrchilds committed
257
    void toggleCanDoHW(bool);
258
    void nGPUsChanged(const QString&);
259
    void toggleTunnelSSH(bool);
260 261 262 263
    void toggleXArgs(bool);
    void xArgsChanged(const QString&);
    void toggleLaunchX(bool);
    void xDisplayChanged(const QString&);
264 265 266 267
    void toggleUseMaxNodes(bool);
    void maxNodesChanged(int);
    void toggleUseMaxProcessors(bool);
    void maxProcessorsChanged(int);
hrchilds's avatar
hrchilds committed
268
private:
269 270 271 272 273
    // Main Window
    QListWidget *hostList;
    QPushButton *addHost;
    QPushButton *delHost;
    QPushButton *copyHost;
274
    QPushButton *exportHost;
275

276
    QTabWidget *machineTabs;
277 278
    QWidget    *machineSettingsGroup;
    QWidget    *launchProfilesGroup;
279
    QWidget    *remoteProfilesGroup;
280 281
    QWidget    *CreateMachineSettingsGroup();
    QWidget    *CreateLaunchProfilesGroup();
282
    QWidget    *CreateRemoteProfilesGroup();
283 284 285 286 287 288 289

    // Launch Profiles
    QListWidget *profileList;
    QPushButton *addProfile;
    QPushButton *delProfile;
    QPushButton *copyProfile;
    QPushButton *makeDefaultProfile;
hrchilds's avatar
hrchilds committed
290 291 292

    QLabel       *profileNameLabel;
    QLineEdit    *profileName;
293 294 295 296
    QCheckBox    *parallelCheckBox;

    QTabWidget *profileTabs;
    QWidget    *basicSettingsGroup;
297
    QWidget    *parallelSettingsGroup;
298
    QWidget    *hwAccelSettingsGroup;
299 300 301 302 303
    QWidget    *CreateBasicSettingsGroup();
    QWidget    *CreateParallelSettingsGroup();
    QWidget    *CreateLaunchSettingsGroup();
    QWidget    *CreateAdvancedSettingsGroup();
    QWidget    *CreateHWAccelSettingsGroup();
304

305 306
    // Parallel Basic Settings
    QTabWidget   *parallelTabs;
hrchilds's avatar
hrchilds committed
307 308 309 310
    QCheckBox    *launchCheckBox;
    QComboBox    *launchMethod;
    QCheckBox    *partitionCheckBox;
    QLineEdit    *partitionName;
311 312 313 314
    QLabel       *numProcLabel;
    QSpinBox     *numProcessors;
    QCheckBox    *numNodesCheckBox;
    QSpinBox     *numNodes;
hrchilds's avatar
hrchilds committed
315 316 317 318
    QCheckBox    *bankCheckBox;
    QLineEdit    *bankName;
    QCheckBox    *timeLimitCheckBox;
    QLineEdit    *timeLimit;
hrchilds's avatar
hrchilds committed
319 320
    QCheckBox    *machinefileCheckBox;
    QLineEdit    *machinefile;
321

322
    // Parallel Advanced Settings
323
    QCheckBox    *useVisItScriptForEnvCheckBox;
hrchilds's avatar
hrchilds committed
324
    QLabel       *loadBalancingLabel;
325
    QComboBox    *loadBalancing;
hrchilds's avatar
hrchilds committed
326 327
    QCheckBox    *launchArgsCheckBox;
    QLineEdit    *launchArgs;
hrchilds's avatar
hrchilds committed
328 329
    QCheckBox    *sublaunchArgsCheckBox;
    QLineEdit    *sublaunchArgs;
330 331 332 333
    QCheckBox    *sublaunchPreCmdCheckBox;
    QLineEdit    *sublaunchPreCmd;
    QCheckBox    *sublaunchPostCmdCheckBox;
    QLineEdit    *sublaunchPostCmd;
334 335 336 337 338
    QLabel       *timeoutLabel;
    QSpinBox     *timeout;

    // Launch HW Accel Settings
    QLabel       *hwdisclaimer;
339
    QGroupBox    *hardwareGroup;
340 341 342 343 344
    QCheckBox    *cbLaunchX;
    QSpinBox     *sbNGPUs;
    QCheckBox    *cbXArgs;
    QLineEdit    *txtXArgs;
    QLineEdit    *txtXDisplay;
345 346 347 348 349 350 351 352 353 354

    // Machine Settings
    QLabel       *hostNameLabel;
    QLineEdit    *hostName;
    QLabel       *hostAliasesLabel;
    QLineEdit    *hostAliases;
    QLabel       *hostNicknameLabel;
    QLineEdit    *hostNickname;
    QLabel       *userNameLabel;
    QLineEdit    *userName;
hrchilds's avatar
hrchilds committed
355
    QCheckBox    *shareMDServerCheckBox;
356
    QCheckBox    *tunnelSSH;
hrchilds's avatar
hrchilds committed
357 358 359 360 361
    QButtonGroup *clientHostNameMethod;
    QRadioButton *chnMachineName;
    QRadioButton *chnParseFromSSHClient;
    QRadioButton *chnSpecifyManually;
    QLineEdit    *clientHostName;
362
    QLabel       *clientHostNameMethodLabel;
hrchilds's avatar
hrchilds committed
363 364
    QCheckBox    *sshPortCheckBox;
    QLineEdit    *sshPort;
365 366
    QCheckBox    *sshCommandCheckBox;
    QLineEdit    *sshCommand;
367 368
    QCheckBox    *useGatewayCheckBox;
    QLineEdit    *gatewayHost;
369 370 371 372
    QLabel       *engineArgumentsLabel;
    QLineEdit    *engineArguments;
    QLabel       *directoryLabel;
    QLineEdit    *directory;
373 374 375 376
    QCheckBox    *maxNodesCheckBox;
    QSpinBox     *maxNodes;
    QCheckBox    *maxProcessorsCheckBox;
    QSpinBox     *maxProcessors;
377 378

    // other stuff
379 380 381
    QComboBox     *remoteUrl;
    QTreeWidget     *remoteTree;
    QMap<QString, QString> remoteData;
382
    QMap<QString, QString> profileMap;
383
    QNetworkAccessManager *manager;
hrchilds's avatar
hrchilds committed
384
    int          profileCounter;
385 386
    MachineProfile *currentMachine;
    LaunchProfile  *currentLaunch;
hrchilds's avatar
hrchilds committed
387 388
};
#endif