Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 12
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
All today's birthdays', congrats!
Alfons (36)
Coronafix (51)
AmonRa (44)


Next birthdays
05/11 ramses (16)
05/11 Arcstarter (31)
05/11 Zak (15)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

CPU, graphics cards ,FPGA, multi pics/audino speed

 1 2 3 
Move Thread LAN_403
Andy
Thu Nov 28 2013, 12:19AM
Andy Registered Member #4266 Joined: Fri Dec 16 2011, 03:15AM
Location:
Posts: 874
Yep.
Is there any way to speed up code like this?

for(l1=0;l1<largenumber;l1++) {
for(l2=0;l2<largenumber;l2++) {
for(l3=0;l3<largenumber;l3++) {


do stuff
}
}
}

I've got four cores, but if I get more, there will be more for loops.

Thanks
Back to top
Carbon_Rod
Thu Nov 28 2013, 04:07AM
Carbon_Rod Registered Member #65 Joined: Thu Feb 09 2006, 06:43AM
Location:
Posts: 1155
Not sure why you nested the loops instead of an abstraction for a dynamic programming solution.
And, there is still an instantiation like cost when going parallel.
Link2

Back to top
Andy
Thu Nov 28 2013, 06:49AM
Andy Registered Member #4266 Joined: Fri Dec 16 2011, 03:15AM
Location:
Posts: 874
Did you mean ?
for(l1=0;l1<largenumber;l1++) {
for(l2=i1+1;l2<largenumber;l2++) {
for(l3=l2+1;l3<largenumber;l3++) {


do stuff
}
}
}
Back to top
Wastrel
Thu Nov 28 2013, 03:29PM
Wastrel Registered Member #4095 Joined: Thu Sept 15 2011, 03:19PM
Location: England.
Posts: 122
GPUs have a very small amount of memory per computational unit and have big penalties for conditional and branched code. In the case of your loops, optimising depends mostly on what 'stuff' actually is.

It sounds like you are trying to bruteforce a problem instead of solving it. Can you tell us any more?
Back to top
Andy
Thu Nov 28 2013, 07:03PM
Andy Registered Member #4266 Joined: Fri Dec 16 2011, 03:15AM
Location:
Posts: 874
I'm not sure how to workout the numbers apart from bruteforce, the below just checks to see if the the combinations when mixed with water can occupier the space

Thanks


unsigned int atoms[85];

atoms[0] = 100000;
for(i=1;i<85;i++) {
atoms[i]=atoms[0]/i;
}

H2O = atoms[7]+(atoms[0]*2);

for(l1=0;l1<largenumber; l1++) {
for(l2=i1+1;l2<largenumber;l2++) {
for(l3=l2+1;l3<largenumber;l3++) {

test = atoms[l]+atoms[l1]+atoms[l2];
test = test + H2O
if(test == 100000 || test == 200000 || test == 300000) {
fprintf(out,"%s%s%s",atomsname[l],atomsname[l1] ,atomsname[l2]);
}
someother test based on numbers

}
}
}
Back to top
Wastrel
Fri Nov 29 2013, 03:01PM
Wastrel Registered Member #4095 Joined: Thu Sept 15 2011, 03:19PM
Location: England.
Posts: 122
The code is currently a bit broken and I'm assuming the actual table is more complicated for real atoms. It is important to get the method working first, then optimise the algorithm and lastly optimise the code.

In the case of this algorithm the first two tests fail automatically because they are less than the value for water on it's own. The goal value, 300000 would best be represented by a variable set to 300000-H2O which pushes code out
of the inner loop (and out of all of them, but this is where it costs the most).

If the real values for atom[x] are a progressive sequence then the inner loop can be replaced by a binary search tree, which would speed up the code by about ten times. If the real values for atom[x] are not in a progressive sequence, then reorder them. The absolute representation of the atoms is not important to the code.
Back to top
Andy
Mon Dec 02 2013, 06:42AM
Andy Registered Member #4266 Joined: Fri Dec 16 2011, 03:15AM
Location:
Posts: 874
Thanks Wastrel
I have to run the bruteforce code more than once, I've saved the combinations to hdd, and will load it in ram, what I understood from the binary search tree, split the combinations into 5 files and can select the part to bruteforce with a check.

@Shrad
Checked out a blade server 24cores 64gig of ram and 2* 1tb hdd for $340 month, Link2
Back to top
Shrad
Mon Dec 02 2013, 08:40AM
Shrad Registered Member #3215 Joined: Sun Sept 19 2010, 08:42PM
Location:
Posts: 780
yup, that's the kind of machines you would use for pure CPU taskforce

you have to use a unix server distro to take full advantage of it through some paralleling libraries

if you have multiple less-capable scavenged servers you also have the opportunity to cluster them, there are specialized distros but that's another story
Back to top
Andy
Mon Dec 02 2013, 04:59PM
Andy Registered Member #4266 Joined: Fri Dec 16 2011, 03:15AM
Location:
Posts: 874
I installed zorin 64bit and have been running from that.

"you would have to add some RAM or you will eat through read/write cycles of your SD card pretty quickly"

I think I fried my second hdd, the program now comes up with Bus error(core dumped) :( , what do you think could be wrong, or is it fixable
Back to top
Shrad
Mon Dec 02 2013, 09:57PM
Shrad Registered Member #3215 Joined: Sun Sept 19 2010, 08:42PM
Location:
Posts: 780
it occurs only with flash memory.. as it has a limited read/write count before a memory cell is dead, if you use some small files which are updated really fast in permanent use, you'll eat the cells pretty fast..

the same will occur with mechanical devices but it will be from mechanical use/abuse

the solution is to create a small ramdisk (something like 4Gb) and make all your file access from there, so you also gain in speed (by a factor of 100 sometimes)
Back to top
 1 2 3 

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.