HPCE / hpce-2014-cw4

3 stars 5 forks source link

refactoring openCL hardware setup/fileread code #15

Closed kronocharia closed 9 years ago

kronocharia commented 9 years ago

I guess this is going to be used a lot and everywhere, so would it make sense to pull this out into a separate header/implementation file?

Would you then recommend that I pass platform, devices, device and context in as individual params by reference, or just have the function spit out a class with all the goodies inside?

If I move LoadSource out into a seperate file, does that still need to be in my login namespace/will it be being in global mess up your robotic marking helpers?

m8pple commented 9 years ago

Sure, it's definitely a good idea, and putting it an header file is probably what I'd do in less pedagogically oriented instructions.

From a marking point of view, any C++ the lives in your src/login directory is yours to control, so while I won't link in any .cpp files there, if you #include some .hpp files using relative paths, that is perfectly fine.

How, you decide to pass in and return things from your utilities - I think that comes more down to personal preference. Probably I'd go for something simpler (functions taking references) until I was sure I was using it enough times to justify creating classes.

kronocharia commented 9 years ago

Ill just move them back all inline, thats easiest I guess

kronocharia commented 9 years ago

I was concerned refactored code (for readability I tossed code blocks in v5 into their own local methods) woulda been slower, but it actually runs faster (sliiightly) . I thought invoking functions caused a small overhead? Or does the compiler potentially do some magic and caused the time to drop. screen shot 2015-02-20 at 14 08 24