Skip to content

Commit

Permalink
Clean up debugging statements and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Klein committed Oct 27, 2023
1 parent 0636193 commit 2a6eb12
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 98 deletions.
78 changes: 7 additions & 71 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
- name: Install Intel OpenCL libraries needed for Sibernetic
run: |
lscpu
echo "Installing OpenCL Drivers"
# Legacy install of Intel's OpenCL Drivers:
# Based on: https://github.com/openworm/OpenWorm/blob/master/Dockerfile
# lscpu
# cat /proc/cpuinfo
# arch
# uname --processor
# uname --machine
# mkdir intel-opencl-tmp
# cd intel-opencl-tmp
# mkdir intel-opencl
Expand All @@ -54,85 +54,21 @@ jobs:
# sudo cp -R /opt/intel/opencl/include/CL /usr/include/
# sudo apt install -y ocl-icd-opencl-dev vim
# # download the key to system keyring
# wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# # add signed entry to apt sources and configure the APT client to use Intel repository:
# echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# sudo apt-get update
# sudo apt-get install -y intel-basekit
# sudo apt-get install -y intel-oneapi-runtime-opencl
# Install AMD's OpenCL Drivers (AMD-APP-SDK 3.0):
wget https://master.dl.sourceforge.net/project/nicehashsgminerv5viptools/APP%20SDK%20A%20Complete%20Development%20Platform/AMD%20APP%20SDK%203.0%20for%2064-bit%20Linux/AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2
tar -xf AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2
# yes Y 2>/dev/null | sudo ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh
printf 'Y\n\n' | sudo ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh
echo "ls /usr/lib:"
ls /usr/lib
echo "ls /usr/lib/x86_64-linux-gnu:"
ls /usr/lib/x86_64-linux-gnu
echo "ls /opt/AMDAPPSDK-3.0:"
ls /opt/AMDAPPSDK-3.0
echo "ls /opt/AMDAPPSDK-3.0/lib/x86_64:"
ls /opt/AMDAPPSDK-3.0/lib/x86_64
echo "ls /opt/AMDAPPSDK-3.0/bin:"
ls /opt/AMDAPPSDK-3.0/bin
echo "ls /opt/AMDAPPSDK-3.0/include:"
ls /opt/AMDAPPSDK-3.0/include
# echo "ln -s /opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so /usr/lib/libOpenCL.so"
# ln -s /opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so /usr/lib/libOpenCL.so
# echo "sudo cp /opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so /usr/lib/libOpenCL.so"
# sudo cp /opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so /usr/lib
# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/AMDAPPSDK-3.0/lib/x86_64/"
echo "sudo ln -s /opt/AMDAPPSDK-3.0/lib/x86_64/sdk/libOpenCL.so.1 /usr/lib/libOpenCL.so.1"
sudo ln -s /opt/AMDAPPSDK-3.0/lib/x86_64/sdk/libOpenCL.so.1 /usr/lib/libOpenCL.so.1
echo "sudo ln -s /opt/AMDAPPSDK-3.0/lib/x86_64/sdk/libamdocl64.so /usr/lib/libamdocl64.so"
sudo ln -s /opt/AMDAPPSDK-3.0/lib/x86_64/sdk/libamdocl64.so /usr/lib/libamdocl64.so
sudo apt install -y ocl-icd-opencl-dev
echo "OpenCL Driver Installation Complete"
echo "CLINFO:"
clinfo
# sudo ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh
# sudo apt install -y pocl-opencl-icd
# ls /usr/include
# dpkg -L intel-basekit
# dpkg -L intel-oneapi-runtime-opencl
# echo "ls /opt/intel"
# ls /opt/intel
# echo "ls /opt/intel/opencl"
# ls /opt/intel/opencl
# echo "ls /opt/intel/oneapi"
# ls /opt/intel/oneapi
- name: Build Sibernetic
run: |
Expand Down
4 changes: 1 addition & 3 deletions src/owHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ void owHelper::loadConfiguration(float *position_cpp, float *velocity_cpp,
size_t pos;
LOADMODE mode = NOMODE;
int i = 0;
std::cout << "in load\n";
if (configFile.is_open()) {
configFile.seekg(read_position);
while (configFile.good()) {
Expand Down Expand Up @@ -360,8 +359,7 @@ void owHelper::loadConfiguration(float *position_cpp, float *velocity_cpp,
} else
throw std::runtime_error("Could not open file configuration file");
configFile.close();
std::cout << "Configuration has been loaded new" << std::endl;
std::cout << "in load end new" << std::endl;
std::cout << "Configuration has been loaded" << std::endl;
}
/** Load configuration from simulation to files
*
Expand Down
45 changes: 23 additions & 22 deletions src/owOpenCLSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,12 @@ void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
sz = sizeof(cBuffer), cBuffer, nullptr);
if (ciErrNum == CL_SUCCESS) {
printf(" CL_PLATFORM_VERSION [%d]: \t%s", i, cBuffer);
std::cout << std::endl;
} else {
printf(" Error %i in clGetPlatformInfo Call !!!\n\n", ciErrNum);
}
}
std::cout << "owCi2" << std::endl;
std::cout << "owCi2a" << std::endl;
// 0-CPU, 1-GPU // depends on the time order of system OpenCL drivers
// installation on your local machine
// CL_DEVICE_TYPE
Expand All @@ -288,45 +289,45 @@ void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
cl_uint device_coumpute_unit_num_current = 0;
unsigned int deviceNum = 0;

std::cout << "owA1" << std::endl;
std::cout << "owCi2b" << std::endl;
// Selection of more appropriate device
while (!findDevice) {
std::cout << "owFD1" << std::endl;
std::cout << "owCfda" << std::endl;
for (int clSelectedPlatformID = 0; clSelectedPlatformID < (int)n_pl;
clSelectedPlatformID++) {
// if(findDevice)
// break;
std::cout << "owFD2" << std::endl;
std::cout << "owCfdb" << std::endl;
clGetDeviceIDs(cl_pl_id[clSelectedPlatformID],
device_type[config->getDeviceType()], 0, nullptr,
&ciDeviceCount);
if ((devices_t = static_cast<cl_device_id *>(
malloc(sizeof(cl_device_id) * ciDeviceCount))) == nullptr) {
std::cout << "owFD3" << std::endl;
std::cout << "owCfdc" << std::endl;
bPassed = false;
}
if (bPassed) {
result = clGetDeviceIDs(cl_pl_id[clSelectedPlatformID],
device_type[config->getDeviceType()],
ciDeviceCount, devices_t, &ciDeviceCount);
std::cout << "owFD4" << std::endl;
std::cout << "owCfdd" << std::endl;
if (result == CL_SUCCESS) {
for (cl_uint i = 0; i < ciDeviceCount; ++i) {
clGetDeviceInfo(devices_t[i], CL_DEVICE_TYPE, sizeof(type), &type,
nullptr);
std::cout << "owFD5" << std::endl;
std::cout << "owCfde" << std::endl;
if (type & device_type[config->getDeviceType()]) {
clGetDeviceInfo(devices_t[i], CL_DEVICE_MAX_COMPUTE_UNITS,
sizeof(device_coumpute_unit_num),
&device_coumpute_unit_num, nullptr);
std::cout << "owFD6" << std::endl;
std::cout << "owCfdf" << std::endl;
if (device_coumpute_unit_num_current <=
device_coumpute_unit_num) {
plList = clSelectedPlatformID;
device_coumpute_unit_num_current = device_coumpute_unit_num;
findDevice = true;
deviceNum = i;
std::cout << "owFD7" << std::endl;
std::cout << "owCfdg" << std::endl;
}
// break;
}
Expand All @@ -345,43 +346,43 @@ void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
std::cout << "Unfortunately OpenCL couldn't find device "
<< deviceTypeName << std::endl;
std::cout << "OpenCL try to init existing device " << std::endl;
std::cout << "owFD8" << std::endl;
std::cout << "owCfdh" << std::endl;
if (config->getDeviceType() != ALL) {
std::cout << "owFD9" << std::endl;
std::cout << "owCfdi" << std::endl;
config->setDeviceType(ALL);
} else {
std::cout << "owFD10" << std::endl;
std::cout << "owCfdj" << std::endl;
throw std::runtime_error("Sibernetic can't find any OpenCL devices. "
"Please check you're environment "
"configuration.");
}
}
}
std::cout << "owA2" << std::endl;
std::cout << "owCi2c" << std::endl;
cl_context_properties cprops[3] = {
CL_CONTEXT_PLATFORM, (cl_context_properties)(platformList[plList])(), 0};
std::cout << "owA21" << std::endl;
std::cout << "owCi2d" << std::endl;
context = cl::Context(device_type[config->getDeviceType()], cprops, nullptr,
nullptr, &err);
std::cout << "owA22" << std::endl;
std::cout << "owCi2e" << std::endl;
devices = context.getInfo<CL_CONTEXT_DEVICES>();
std::cout << "owA23" << std::endl;
std::cout << "owCi2f" << std::endl;
if (devices.size() < 1) {
std::cout << "owA24" << std::endl;
std::cout << "owCi2g" << std::endl;
throw std::runtime_error("No OpenCL devices were found");
}
std::cout << "owA25" << std::endl;
std::cout << "owCi2h" << std::endl;
// Print some information about chosen platform
size_t compUnintsCount, memoryInfo, workGroupSize;
std::cout << "owA26" << std::endl;
std::cout << "owCi2i" << std::endl;
result = devices[deviceNum].getInfo(CL_DEVICE_NAME,
&cBuffer); // CL_INVALID_VALUE = -30;
std::cout << "owA3" << std::endl;
std::cout << "owCi2j" << std::endl;
if (result == CL_SUCCESS) {
std::cout << "CL_CONTEXT_PLATFORM [" << plList << "]: CL_DEVICE_NAME ["
<< deviceNum << "]:\t" << cBuffer << std::endl;
<< deviceNum << "]:\t" << cBuffer << std::endl << std::endl;
}
std::cout << "owA4" << std::endl;
std::cout << "owCi2k" << std::endl;
if (strlen(cBuffer) < 1000) {
config->setDeviceName(cBuffer);
}
Expand Down
3 changes: 1 addition & 2 deletions src/owPhysicsFluidSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,12 @@ owPhysicsFluidSimulator::owPhysicsFluidSimulator(owHelper *helper, int argc,
density_cpp = new float[1 * config->getParticleCount()];
particleIndex_cpp = new unsigned int[config->getParticleCount() * 2];

std::cout << "pre load\n";
// LOAD FROM FILE
owHelper::loadConfiguration(
position_cpp, velocity_cpp, elasticConnectionsData_cpp,
membraneData_cpp, particleMembranesList_cpp,
config); // Load configuration from file to buffer
std::cout << "post load" << std::endl;

std::cout << "owP1" << std::endl;
this->helper = helper;
std::cout << "owP1a" << std::endl;
Expand Down

0 comments on commit 2a6eb12

Please sign in to comment.