Jump to content

Running 64Bit in Steam with Linux: Solution.


Recommended Posts

I'm running the Steam version of KSP, using 64Bit Linux Mint with the KDE desktop environment, on an i7 laptop with 16GB of RAM and an NVIDIA GPU.

I thought for the first while that Steam had automatically installed and was running the 64 Bit, multi-CPU version of KSP. Of course it wasn't, and as I started progressing in the game and adding mods, I started hitting the RAM wall and I knew something was up. Found the solution and my performance went through the roof. No crashes, Graphics are maxed.

I'll get to the point: If you are a 64bit Linux user, running KSP in Steam, it is automatically running the 32bit version as it assumes the 64bit version is still too experimental and buggy (which it isn't particularly). So here is how to do it.

EDIT: This fix works best for those with NVIDIA graphics cards, but Intel/ATI cards and everyone else you can also benefit, please scroll down to the bottom :)

For people with NVIDIA GPU, You will definitely benefit from the following:

1) First, create a text file in your KSP folder and name it ksp.sh

Open
ksp.sh
in your favourite text editor and add the following script:

For Multiple Cores:

#!/bin/sh


export LC_ALL=C
export LD_PRELOAD="libpthread.so.0 libGL.so.1"
export __GL_THREADED_OPTIMIZATIONS=1
exec taskset -c 2-3 ./KSP.x86_64

For Single Cores:

#!/bin/sh

export LC_ALL=C
export LD_PRELOAD="libpthread.so.0 libGL.so.1"
export __GL_THREADED_OPTIMIZATIONS=1
./KSP.x86_64

2)
Save and exit

3)
Right click on
ksp.sh
and check the
make executable
box in the permissions tab.

OR if your version of linux does not have that functionality, then do it via terminal as follows:

As root, open a terminal in your KSP folder and enter the following code:

chmod +x ./ksp.sh

4)
Now simply double click on
ksp.sh
to launch KSP whenever you want to play.

5)
Blow things up with your new performance!

6)
Profit

(note: if you use the steam launcher to play, it will revert to 32bit. Always use this ksp.sh shell script to launch KSP!)

For NON-NVIDIA users:

The simplest way is to just open up Steam, right-click KSP, select Properties, click on Set Launch Options, and enter

LC_ALL=C %command%_64

you can then launch the game normally.

However, you can still benefit, although not to the same degree by using a shell script. This will run the game without the Steam Overlay and also it will set the processors to the second and third, leaving the 1st processor handling OS and background processes, which will save you a tiny bit of RAM and quite a bit of processor power.

1)
First, create a text file in your KSP folder and name it
ksp.sh

Open
ksp.sh
in your favourite text editor and add the following script:

For Multiple Cores:

#!/bin/sh

export LC_ALL=C
exec taskset -c 2-3 ./KSP.x86_64

For Single Cores:

#!/bin/sh

export LC_ALL=C
./KSP.x86_64

2)
Save and exit

3)
Right click on
ksp.sh
and check the
make executable
box in the permissions tab.

OR if your version of linux does not have that functionality, then do it via terminal as follows:

As root, open a terminal in your KSP folder and enter the following code:

chmod +x ./ksp.sh

4)
Now simply double click on
ksp.sh
to launch KSP whenever you want to play.

(note: if you use the steam launcher to play, it will revert to 32bit. Always use this ksp.sh shell script to launch KSP!)

I hope this helps someone! :D

Edited by KerBlam
missing important info
Link to comment
Share on other sites

Not to rain on your parade, but there is a much simpler way to do this. Open up Steam, right-click KSP, select Properties, click on Set Launch Options.

Enter the following:

LC_ALL=C %command%_64

Confirm all dialogs and run KSP via Steam. :)

Link to comment
Share on other sites

My parade is pretty well weatherproof these days :P

Yes changing the launch script in Steam will use the x86_64 launcher that is included in KSP, however it doesn't change the threaded optimisation or force OPENGL settings so you probably won't notice much difference. I definitely noticed a large difference going the long way, and yep, I tried both.

Edited by KerBlam
Link to comment
Share on other sites

Except, KSP for Linux already uses OpenGL, there's absolutely no point in forcing it because it's already on.

I'm not sure about the thread optimisations though, it is reported to work for some people and not for others, might be hardware dependant.

But yeah, Steam starts x32 by default, but it's easy to change ;)

Changing to solved as players will be more likely to take a look here if they think they will find the answer to their question, good work Kerblam, I hope it helps people :)

Edited by sal_vager
Link to comment
Share on other sites

Except, KSP for Linux already uses OpenGL, there's absolutely no point in forcing it because it's already on.

I'm not sure about the thread optimisations though, it is reported to work for some people and not for others, might be hardware dependant.

But yeah, Steam starts x32 by default, but it's easy to change ;)

Changing to solved as players will be more likely to take a look here if they think they will find the answer to their question, good work Kerblam, I hope it helps people :)

Thanks! :D

Can't quite remember, I'm a long term linux user (circa 2006), but no guru.

I just had a look further into what this is actually doing, and it seems that I am getting a benefit, because what it does is forces an NVIDIA card to use a specific library, in the case where the NVIDIA OpenGL driver library is dynamically loaded after Xlib has been loaded and initialized. If that is the case, threaded optimizations will stay disabled unless the application is modified to call XInitThreads() before initializing Xlib or to link directly against the NVIDIA OpenGL driver library.

So I'm going to edit the OP to reflect that only NVIDIA users will benefit from the export LD_PRELOAD="libpthread.so.0 libGL.so.1 line and the LD_PRELOAD function. It shouldn't cause problems for other GPU's but it certainly won't benefit them.

Another benefit which I forgot to mention in favour of running out of the shell script, even without the LD_PRELOAD function, is that it will run without the Steam overlay, saving you some resources. :)

edit: Sorry for the multiple edits, It's confusing now, I had to reformat the whole OP so it made more sense. :rolleyes: edit: done editing.

Edited by KerBlam
The dishes are done
Link to comment
Share on other sites

Ooooh shiny!

The performance do seem a bit better, although I wouldn't know how to benchmark that.

You sir, are a good man.

Nb: small improvement: adding " CURRENT_PATH=`dirname $0` " then " exec taskset -c 2-3 $CURRENT_PATH/KSP.x86_64 " make it possible to be called from anywhere.

Link to comment
Share on other sites

Ooooh shiny!

The performance do seem a bit better, although I wouldn't know how to benchmark that.

You sir, are a good man.

Nb: small improvement: adding " CURRENT_PATH=`dirname $0` " then " exec taskset -c 2-3 $CURRENT_PATH/KSP.x86_64 " make it possible to be called from anywhere.

Thanks! Although the taskset -c 2-3 modifier is only for multiple cores.

I just had a crazy thought!:- I hope nobody is trying to play this game on a single solitary core. :0 It would be like watching a slideshow haha

What specs are you running wibou?

Edited by KerBlam
MOAR
Link to comment
Share on other sites

One simple solution is to copy your 32bit executable to KSP.x86_32 and then creating a link to your appropriate executable (usually KSP.x86_64) as KSP.x86.

Interesting workaround, however you're not getting the most out of your computer doing it that way you're just tricking it into running a different executive.

If you haven't tried one of the shell solutions, I urge you to give it a go and post results. If you don't like it for whatever reason, you can simply delete the ksp.sh file you created. No harm done.

Link to comment
Share on other sites

  • 1 month later...
For Multiple Cores:

For Multiple Cores:

Code:

#!/bin/sh

export LC_ALL=C

export LD_PRELOAD="libpthread.so.0 libGL.so.1"

export __GL_THREADED_OPTIMIZATIONS=1

exec taskset -c 2-3 ./KSP.x86_64

Any way to do this through the Steam launch options?

Link to comment
Share on other sites

  • 2 months later...

I might be a idiot but shoulden't this work in the launch options dialog?

LC_ALL=C LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 exec taskset -c 2-3 %command%_64

Anyone that could verify that the variables are properly set? The 64 bit and exec part seems to work.

Link to comment
Share on other sites

  • 4 months later...

I've got a feeling I didn't get my installation right at all!

I'm on a 64 bit Linux (Ubuntu LTS) system, and ksp.x86_64 crashes instantly with no error message, the x86 only one and the sh file does nothing. I can only start the game through Steam; at least I could until I transfered over my mods and saves from my Windows install and now it crashes every time while loading when launching through steam.

Help?

Link to comment
Share on other sites

  • 9 months later...

As of 1.1.x you don't want to limit to 2 cores.   KSP is now capable of utilizing as many cores as you have.

 

On 5/16/2015 at 7:01 AM, larlin said:

I might be a idiot but shoulden't this work in the launch options dialog?

 

 

LC_ALL=C LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 exec taskset -c 2-3 %command%_64

 

Anyone that could verify that the variables are properly set? The 64 bit and exec part seems to work.

You need to insert a line divider of some sort there.  I'm not sure what it is.

Also, "exec taskset -c 2-3" is no longer an optimal option as of KSP 1.1 due to the fact that KSP now utilizes all cores.  (At least up to 10, I'm not sure the maximum number the updated PhysX library is compiled for.)

There may be another option to discourage moving the threads between cores, which would improve CPU Cache hits without slowing down the physics simulation.  I know there is one somewhere in the /sys fs or /proc/sys fs.  (I forget which or where.)

Link to comment
Share on other sites

  • 4 months later...

Is creating the executable ksp.sh still required to push KSP into 64 bit mode in Linux?

I am playing on Steam running 1.2.1 and have added the option %command%_64. How do I tell if I am running 64 bit KSP? I do not see the rainbow kitty when I launch KSP.

Sorry if this question is lame and for replying to such an old thread. This is my second week with Linux and KSP is the first program I am trying to run in Linux.

Is there a dedicated linux area I should be asking this question in?

Edited by CranialRectosis
Link to comment
Share on other sites

I run linux Mint and all I have to do is dblclick the KSP.x86_64 file and it works (in as much as KSP can be called working).

I stopped playing through Steam Aaaaages ago.  When I first started using chatterer. It would crash sometimes on loading.

When I stopped using Steam the game ran hundreds of percent better.

My first bit of advice for people who play through Steam is... Don't.

 

 

Link to comment
Share on other sites

  • 2 weeks later...
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...