function success = initclient()
; %#ok Undocumented
% Copyright 2004-2020 The MathWorks, Inc.

% initclient may be called multiple times because clear classes will clear
% the schema.

% Don't call this on a worker
if feature('isdmlworker')
    success = false;
    return
end

% Call the common initialization
initcommon();

% Register a validator with profiles (if one does not already exist)
if isempty(parallel.settings.Profile.hGetRegisteredValidator())
    validator = parallel.internal.validator.Validator();
    parallel.settings.Profile.hRegisterValidator(validator);
end

% Raise the soft limit for processes on Linux to accommodate large pools.
if isunix
    % There is a small chance that accessing or raising a system limit is restricted
    % if we fail we will log that and continue.
    try
        processLimits = parallel.internal.local.getProcLimit();
        dctSchedulerMessage(2, 'Current process limits soft: %u, hard: %u', ...
            processLimits(1), processLimits(2));
        
        % If the soft limit is less than the hard limit then raise the limit to either the
        % hard limit or the recommended limit we documented.
        if processLimits(1) < processLimits(2)
            recommendedLimit = uint64(23741);
            newSoftLimit = min(processLimits(2), recommendedLimit);
            newProcessLimits = parallel.internal.local.setProcLimit(newSoftLimit);
            dctSchedulerMessage(2, 'Raised process limit from %u to %u', ...
                processLimits(1), newProcessLimits(1));
        end
    catch E
        dctSchedulerMessage(2, 'Failed to access or raise the process limits:\n%s', E.message);
    end
end

success = true;
end
