Forums › SM Series Discussions › SM200A Needs
- This topic has 6 replies, 2 voices, and was last updated 5 years, 4 months ago by kaiser.
- AuthorPosts
kaiserParticipantWe’ve been using the SM200A for one of our current projects, and it works quite well. Our next project(s), we’re looking at utilizing two SM200A units working in parallel with each other. Notionally everything becomes easier if I run them off of the same system.
I’m assuming that a fairly beefy processor (10 core, 20 thread Xeon processor), or a two-socket server with appropriate RAM would be enough processing oomph (our current 4 core server is only partially utilizing two of the cores to accomplish the task). I’m a bit more worried about USB throughput. I’m assuming that if I ensure my server has USB 3.1 Gen 2, which has double the throughput of regular USB 3.0/3.1 Gen 1 that I should be fine to run two SM200A’s full bore fast-sweeping.
But I guess my question is, has anyone tested it? Do we know the limitations? I can decide to use two computers, but it makes the programming, synchronization and everything else that much more of a chore. I’d definitely prefer to use just one, as it should have more than enough resources.
Thanks all.
AndrewModerator- This reply was modified 5 years, 4 months ago by Andrew.
Kaiser,
We have several customers running multiple SM200s on a single PC. I’m aware of one customer running 4 SM’s streaming I/Q.
You are correct in that the biggest issue is generally USB throughput, but we have found that 2 SM’s will run just fine on a single PC (higher end desktop). You only really need to consider USB adapter cards above 2 SM’s.
If you are on Windows, everything should just work out of the box. If you are on Linux, take a look at the appendix in the latest API manual. I have some notes for multi-unit use on Linux.
How much processing power you need it really going to be dependent on what type of processing you add to the system. A standard 4 core PC will run 2 SM’s if you did not perform any processing.
Regards
kaiserParticipant- This reply was modified 5 years, 4 months ago by kaiser.
Great Andrew, thanks for the useful and prompt response, like always 🙂
My mechanical guy is wondering if you have a model? If not he can model one up in SolidWorks.
AndrewModeratorKaiser,
Email justin at signalhound dot com with your model question. We might have something that could help.
Regards
kaiserParticipant- This reply was modified 5 years, 4 months ago by kaiser.
Thanks Andrew. I’m running through what you mentioned in the Appendix of the latest API and it’s all making sense.
However, my customer’s policy is that we can’t run processes on our delivered hardware as root. Too much of a security concern there; they want scoped permissions. So I gotta get a way around that (or just use Windows, which is fine, they just prefer Linux). I can see a couple of potential ways to script this without having to run as root. Can you let me know what you think and/or test a couple of these options?
1. Add the nice command to thesudoers file with NOPASSWD. I’ve already done this for system shutdown / restart so that my application (user) can run the command to shutdown the system while not being root. Would adding the “nice” command to not require a password, and then running my application with something like a nice level of -20 (normally requires root, max priority level) result in effectively the same performance as running while root?
2. Adjust the limits.conf file and allow the user to launch applications with a higher than typical priority. Would be very similar to #1 I think, but would I think allow the pthread to get it directly without having to alter how you run the program.
3. Launch a setcap() with root during startup to allow the process itself to run at higher priority (might run into issues where just the main process / thread has high priority, but spawned processes or threads don’t? Haven’t ever used this capability so I’m not sure of any pitfalls).
Thoughts?
AndrewModeratorTo ensure the least amount of data loss over USB elevating the thread priority is the best(only?) way we have found to do this. As far as I know root privilege is required for this on Linux (not the case on Windows).
With multiple devices actively making measurements, you will experience data loss if this isn’t done.
I had another customer do a bit of testing with niceness levels and it never resulted in an adequate solution. (His processing would still swamp the CPU and cause data loss events while I/Q streaming despite using niceness levels and despite pulling his processing out into separate processes.)
Below is the snippet we use to do this. You are free to play around and determine if one of your solutions will work. The result of the pthread_setschedparam() will indicate when it fails due to privilege issues. We don’t push this status back out to the user, but I have a request to in a future update. That way the user can ensure the API is setting the proper priority. The API doesn’t check (or care) if it fails at the moment.
void ElevateThreadPriority(std::thread &t)
{
pthread_t this_thread = (pthread_t)t.native_handle();struct sched_param params;
int tp = 10;
params.sched_priority = tp;int res = pthread_setschedparam(this_thread, SCHED_FIFO, ¶ms);
}
kaiserParticipant- This reply was modified 5 years, 4 months ago by kaiser.
Thanks Andrew. I’ll play with it once we order the SM200’s since it’s not currently a pressing issue for us. Just exploring potential risks.
Our processing is also in other threads, and we’re seeing pretty low utilization compared to what we expected so we might be ok. I can write a simple program to check that it’s working or not, but it’s always useful to make sure that you’ve set the right permissions on the actual final executable process 🙂
I updated our current script to use #1 above, set the process to -10 nice and was able to execute it without having to sudo. htop showed it at -10 nice level, and it did seem to get first priority over CPU resources. Used -20 (realtime, aka all the CPU) and it did consume all of the CPU. So it should be easy to test once I get to that point.
But reading more about it, niceness probably isn’t going to work.
The easiest way would be to allow your application to run as root by editing the sudoers file to allow it without password. But then you’re giving all root capabilities to the .exe, which if altered could result in complete pwnage of the system.
Next easiest woul be to allow access to a command, like set_rlimit
or chrt or setcap() via the sudoers file. That should be simple and safe, but I’m not in a place to test it right now. Linux just has so many darn ways to skin a cat, it can be hard to figure out which one is the best.- AuthorPosts
You must be logged in to reply to this topic.