<commit_before>/*
 * Encog(tm) Core v2.5 - Java Version
 * http://www.heatonresearch.com/encog/
 * http://code.google.com/p/encog-java/
 
 * Copyright 2008-2010 Heaton Research, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *   
 * For more information on Heaton Research copyrights, licenses 
 * and trademarks visit:
 * http://www.heatonresearch.com/copyright
 */
package org.encog.engine.network.train.prop;

import org.encog.Encog;
import org.encog.engine.data.EngineDataSet;
import org.encog.engine.data.EngineIndexableSet;
import org.encog.engine.network.flat.FlatNetwork;
import org.encog.engine.opencl.EncogCLDevice;

public class OpenCLTrainingProfile {
	
	private final EncogCLDevice device;
	private final int numGlobalWorkItems;
	private final int itemsPerGlobalWorkItem;
	
	public OpenCLTrainingProfile(EncogCLDevice device, int numGlobalWorkItems,
			int itemsPerGlobalWorkItem) {
		super();
		this.device = device;
		this.numGlobalWorkItems = numGlobalWorkItems;
		this.itemsPerGlobalWorkItem = itemsPerGlobalWorkItem;
	}
	
	public OpenCLTrainingProfile(EncogCLDevice device) {
		this(device,100,10);
	}

	/**
	 * @return the device
	 */
	public EncogCLDevice getDevice() {
		return device;
	}

	/**
	 * @return the numGlobalWorkItems
	 */
	public int getNumGlobalWorkItems() {
		return numGlobalWorkItems;
	}

	/**
	 * @return the itemsPerGlobalWorkItem
	 */
	public int getItemsPerGlobalWorkItem() {
		return itemsPerGlobalWorkItem;
	}

	public static OpenCLTrainingProfile createProfile(final FlatNetwork network, final EngineIndexableSet training) {
		EncogCLDevice device = Encog.getInstance().getCL().chooseDevice();
		if( device.isCPU() ) {
			int numGlobalWorkItems = 200;
			int itemsPerGlobalWorkItem = (int)training.getRecordCount();
			return new OpenCLTrainingProfile(device,numGlobalWorkItems,itemsPerGlobalWorkItem);
		}
		else
			return new OpenCLTrainingProfile(device);
	}

	public static OpenCLTrainingProfile createProfile() {
		EncogCLDevice device = Encog.getInstance().getCL().chooseDevice();
		return new OpenCLTrainingProfile(device);
	}
}
<commit_msg>Fixes for OpenCL<commit_after>/*
 * Encog(tm) Core v2.5 - Java Version
 * http://www.heatonresearch.com/encog/
 * http://code.google.com/p/encog-java/
 
 * Copyright 2008-2010 Heaton Research, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *   
 * For more information on Heaton Research copyrights, licenses 
 * and trademarks visit:
 * http://www.heatonresearch.com/copyright
 */
package org.encog.engine.network.train.prop;

import org.encog.engine.EncogEngine;
import org.encog.engine.data.EngineDataSet;
import org.encog.engine.data.EngineIndexableSet;
import org.encog.engine.network.flat.FlatNetwork;
import org.encog.engine.opencl.EncogCLDevice;

public class OpenCLTrainingProfile {
	
	private final EncogCLDevice device;
	private final int numGlobalWorkItems;
	private final int itemsPerGlobalWorkItem;
	
	public OpenCLTrainingProfile(EncogCLDevice device, int numGlobalWorkItems,
			int itemsPerGlobalWorkItem) {
		super();
		this.device = device;
		this.numGlobalWorkItems = numGlobalWorkItems;
		this.itemsPerGlobalWorkItem = itemsPerGlobalWorkItem;
	}
	
	public OpenCLTrainingProfile(EncogCLDevice device) {
		this(device,100,10);
	}

	/**
	 * @return the device
	 */
	public EncogCLDevice getDevice() {
		return device;
	}

	/**
	 * @return the numGlobalWorkItems
	 */
	public int getNumGlobalWorkItems() {
		return numGlobalWorkItems;
	}

	/**
	 * @return the itemsPerGlobalWorkItem
	 */
	public int getItemsPerGlobalWorkItem() {
		return itemsPerGlobalWorkItem;
	}

	public static OpenCLTrainingProfile createProfile(final FlatNetwork network, final EngineIndexableSet training) {
		EncogCLDevice device = EncogEngine.getInstance().getCL().chooseDevice();
		if( device.isCPU() ) {
			int numGlobalWorkItems = 200;
			int itemsPerGlobalWorkItem = (int)training.getRecordCount();
			return new OpenCLTrainingProfile(device,numGlobalWorkItems,itemsPerGlobalWorkItem);
		}
		else
			return new OpenCLTrainingProfile(device);
	}

	public static OpenCLTrainingProfile createProfile() {
		EncogCLDevice device = EncogEngine.getInstance().getCL().chooseDevice();
		return new OpenCLTrainingProfile(device);
	}
}

{'fraction_non_alphanumeric': 0.08800738007380074, 'fraction_numerical': 0.008118081180811807, 'mean_word_length': 3.9192377495462796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6987733', 'n_tokens_mistral': 1702, 'n_tokens_neox': 1526, 'n_words': 420}