API to integrate FAH in 3rd party applications

If you're new to FAH and need help getting started or you have very basic questions, start here.

Moderators: Site Moderators, FAHC Science Team

Post Reply
phowell
Posts: 3
Joined: Wed Aug 23, 2017 2:23 am

API to integrate FAH in 3rd party applications

Post by phowell »

Hey FAH community,

I messaged the FAH team earlier this week to ask if an API had been considered to let 3rd party applications enable folding when spare CPU/GPU/memory cycles become available. This could be a useful way in expanding the FAH program and incentivizing users in other apps to fold.

Unfortunately, it sounds like security is a blocker for this idea. Does anyone in the community know what the security concern might be? Malicious users may wanting to abuse an API comes to mind but I wanted to see if there was something else that I was missing.
Joe_H
Site Admin
Posts: 7867
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: API to integrate FAH in 3rd party applications

Post by Joe_H »

Welcome to the folding support forum.

There already is an API provided for third party applications to use, details on it are here - https://fah-web.stanford.edu/projects/F ... eInterface. This is on the old support pages, so you may get a warning of an expired certificate when you go to the site, if you accept it you should be able to navigate to there. It has not been updated since around version 7.2.

Properly implemented, passwords are required to interface over the provided port. It is intended for use on your local network.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: API to integrate FAH in 3rd party applications

Post by bruce »

to integrate with anouter application, the most reqluested featulre (and it sounds like the one you're thinking of) is to start/stop fah's heavy processing. Fundamentqally, you'd need to start Fah PROCESSING AND THEN YOU HAVE THE OPTION TO PAUSE/UNPOUSE FAH's processinig. which is pretty easy by sending those commands by way of a telnet-like message.

If you're using CPU resources, there's really no need to do that sinc FAH only uses unused CPU resourdces. If you're folding with GPU resources, the PAUSE/UnPAUSE can be considered automatic because with a simple configurationb step setting "idle" = "tru" GPU processing will start/stop using reources by responding to hte operating system's idle signal, just like a screensaver would.
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: API to integrate FAH in 3rd party applications

Post by bruce »

to integrate with anouter application, the most reqluested featulre (and it sounds like the one you're thinking of) is to start/stop fah's heavy processing. Fundamentqally, you'd need to start Fah PROCESSING AND THEN YOU HAVE THE OPTION TO PAUSE/UNPOUSE FAH's processinig. which is pretty easy by sending those commands by way of a telnet-like message.

If you're using CPU resources, there's really no need to do that sinc FAH only uses unused CPU resourdces. If you're folding with GPU resources, the PAUSE/UnPAUSE can be considered automatic because with a simple configurationb step setting "idle" = "tru" GPU processing will start/stop using reources by responding to hte operating system's idle signal, just like a screensaver would.

What else did you have in mind?
phowell
Posts: 3
Joined: Wed Aug 23, 2017 2:23 am

Re: API to integrate FAH in 3rd party applications

Post by phowell »

Thanks, Joe & Bruce.

Can this API be used outside of a local network? It looks like that's unfortunately not the case.

Ideally, I was hoping to integrate FAH via an API into an upcoming game I have since it only uses 50% of CPU, GPU & memory at its peak times. My thought was that the other 51-100% could be used to fold based on whatever the user is comfortable dedicating.
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: API to integrate FAH in 3rd party applications

Post by bruce »

Does your game run at NORMAL or LOW or IDLE priority? If it's Normal, FAH will cut back its utilization from 100% to 50% because it runs at the lowest possible priority. Is that not happening?
ChristianVirtual
Posts: 1596
Joined: Tue May 28, 2013 12:14 pm
Location: Tokyo

Re: API to integrate FAH in 3rd party applications

Post by ChristianVirtual »

Technically the interface use cleartext TELNET-style commands.

On order to make it secure you have basically two options:
1) VPN
2) SSH-Tunnel

Then still use the insecure TELNET over those secure connections.

Thats what I use with my iPad app; meanwhile I just use SSH-Tunnel with private/public key and don't bother with VPN anymore too often. Works quite good. But sure beyond regular FAH software stack.
ImageImage
Please contribute your logs to http://ppd.fahmm.net
phowell
Posts: 3
Joined: Wed Aug 23, 2017 2:23 am

Re: API to integrate FAH in 3rd party applications

Post by phowell »

It runs at normal priority and the FAH client continues to fold so I don't think device resources are an issue. Rather than pinging the FAH client directly from the game, do you think there is a way to authenticate a FAH username, password and get the total points they've earned? I'm thinking the solution here could be just verifying the user's FAH account + points and giving them in-game rewards.
ChristianVirtual
Posts: 1596
Joined: Tue May 28, 2013 12:14 pm
Location: Tokyo

Re: API to integrate FAH in 3rd party applications

Post by ChristianVirtual »

via the API you get the actual time a current WU is in progress plus the estimated credit ; you could prorate it and use in the game. Access to the JSON driven stats site not help much as it linked to the computer the game is running. But if that is what you want have a look here: http://folding.stanford.edu/stats/api

Another option you download the public available user stats every day and if you have a server around your game could download from there. Many options.

It must be a very interesting game as the runtimes of WU tend to be several hours at times. Beside flight simulator and DOOM I don't remember a game kept be longer in front of the computer ;-)
ImageImage
Please contribute your logs to http://ppd.fahmm.net
Post Reply