This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void NetworkGenetic::allocateHostAndGPUObjects( size_t deviceRam, size_t hostRam){ | |
long int hostGenSize = hostRam; | |
long int deviceGenSize = deviceRam; | |
std::cerr<<"total free device ram : "<<deviceRam<<std::endl; | |
std::cerr<<"total free host ram : "<<hostRam<<std::endl; | |
//this block below makes sure that the number of objects in stream is exactly half of the total amount of allocatable space on the GPU | |
_streamSize = deviceGenSize/(sizeof(double)*2); | |
while(_streamSize%_hostParams.array[2] || (_streamSize/_hostParams.array[2])&(_streamSize/_hostParams.array[2]-1)) // get the largest number divisible by the individual size, the threads in a block, and the size of a double |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project(Earthquake_Forecaster) | |
cmake_minimum_required(VERSION 3.2.1) | |
find_package(CUDA REQUIRED) | |
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/headers) | |
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src) | |
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/kernels) | |
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libs/rapidjson/include) | |
LINK_DIRECTORIES(/usr/local/cuda/lib64) | |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <neuroFunc.h> | |
#include <utilFunc.h> | |
__host__ __device__ void neuroSum(double &store, double &input){ | |
store += input; | |
} | |
__host__ __device__ void neuroMulti(double &store, double &input){ | |
store *= input; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by james on 27/01/16. | |
*/ | |
import algorithmia.VideoSplits._ | |
import org.scalatest._ | |
//TODO: figure out how to return a data:// string instead of a https://api.algorithmia.com/v1 string | |
class splitSpec extends FunSuite with Matchers{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by james on 27/01/16. | |
*/ | |
import algorithmia.VideoSplits._ | |
import com.algorithmia.Algorithmia | |
import org.scalatest._ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class SplitOnce(inputVideoUrl: String, | |
outputFolder: String, | |
outputFilename: String, | |
startTime: String, | |
stopTime: String) extends Inputs{ | |
require(inputVideoUrl != null, "input video must not be null.") | |
require(outputFolder != null, "output folder must not be null.") | |
require(outputFilename != null, "output Filename must not be null.") | |
require(startTime != null, "start time must not be null.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.externals import joblib | |
self.svmStorage = "/tmp/svm/" | |
def onConnect(self, request): | |
print("Client connecting: {0}".format(request.peer)) | |
self.training = True | |
self.svm = joblib.load(self.svmStorage + 'my_model.pkl') | |
def saveSVM(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var itrTrain: Int = 0 | |
trainDirectoryLabels.foreach(directory => { | |
val label = itrTrain | |
itrTrain += 1 | |
val images = directory.listFiles.toList | |
images.foreach(image => { | |
val vec = new ImageVectorizer(image, numOfTrainLabels, label) | |
val imageSet: DataSet = vec.vectorize() | |
model.fit(imageSet) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val imageRecordReader = new ImageRecordReader(250, 250, 3, labels) | |
imageRecordReader.initialize(new FileSplit(rawDir)) | |
val iterator: DataSetIterator = new RecordReaderDataSetIterator(imageRecordReader, batchSize, 0, labels.length) | |
while(iterator.hasNext){ | |
val nextData: DataSet = iterator.next | |
nextData.scale() | |
val trainTest = nextData.splitTestAndTrain(0.25d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class SplitOnce(inputVideoUrl: String, | |
outputFolder: String, | |
outputPrefix: String, | |
outputExtension: String, | |
startTime: String, | |
stopTime: String) extends Inputs | |
//this had a runtime exeception, SplitOnce.getClass returned the SplitOnce Companion Obj |