Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ow 0.9.4 - Passing tests building sibernetic using Intel and AMD drivers #189

Merged
merged 65 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
65ed3a0
Update README.md
austinklein Sep 3, 2023
d0f6f9a
Update README.md
austinklein Sep 3, 2023
ddbb5a6
Update ci-build.yml
austinklein Sep 3, 2023
0db6199
Add debug print stagements
Sep 3, 2023
53c43d8
Merge branch 'ow-0.9.4' of https://github.com/austinklein/sibernetic …
Sep 3, 2023
90ab231
Remove endl
Sep 3, 2023
4b420c5
Added endl
Sep 3, 2023
c0e867d
Added additional endl
Sep 3, 2023
568a01d
Added step for git to use LF
austinklein Sep 3, 2023
c6f4dcb
Added all endl
Sep 3, 2023
16b3c01
Merge branch 'ow-0.9.4' of https://github.com/austinklein/sibernetic …
Sep 3, 2023
3c86c74
Remove newline
Sep 3, 2023
9a20c66
Remove additional newlines
Sep 3, 2023
b0cc491
Add debugging print statements
Sep 3, 2023
822d630
Add additional debugging print statements
Sep 3, 2023
fbd0687
Update workflows to ubuntu-latest
austinklein Sep 24, 2023
35e1c3b
Install pocl-opencl-icd
Sep 24, 2023
bee4aa1
Determine github actions cpu info
Sep 24, 2023
a4f02c9
Additional debug print statements
Sep 27, 2023
a1f5f98
Fixed brackets
Sep 27, 2023
d9e68f9
Attempt using Intel OneAPI
Sep 28, 2023
980b492
Attempt using Intel OneAPI with apt-get
Sep 28, 2023
7a6e1bd
Add Intel OneAPI repositories
Sep 28, 2023
b86efde
Add missing pipe
Sep 28, 2023
617c5a0
Add missing pipe
Sep 28, 2023
c1beb84
List directories of OpenCL
Sep 28, 2023
2f20eb3
List directories of OpenCL
Sep 28, 2023
b7c23af
List directories of OpenCL
Sep 28, 2023
f0d719f
Added Xeon OpenCL runtime with previous install
Sep 28, 2023
4c76683
Rebase
Sep 29, 2023
e02eb67
Remove Intel OneAPI and BaseKit
Sep 29, 2023
a4ee677
Fix AMD APP SDK url
Sep 29, 2023
9ac763b
Answer yes to AMD APP SDK
Sep 29, 2023
79b6caa
Answer Y to AMD APP SDK
Sep 29, 2023
84ea09b
Pipe to null
Sep 29, 2023
f8463e6
Sudo
Sep 29, 2023
f89af37
Sudo and dev null
Sep 29, 2023
c531db7
Newlines
Sep 29, 2023
4ee2118
Remove directory listings
Sep 29, 2023
56e9d2d
Remove Intel OpenCL
Sep 29, 2023
e92bc77
clinfo and list directories
Oct 9, 2023
c7b45d4
Change order of clinfo
Oct 9, 2023
b7b182b
Deeper directory listing
Oct 9, 2023
fae6b29
Additional lists
Oct 9, 2023
708610c
List AMDAPPSDK x86_64
Oct 9, 2023
58ecd27
Symlink to libOpenCL.so
Oct 9, 2023
520f320
Symlink print
Oct 9, 2023
5db045c
cp instead of ln
Oct 15, 2023
4acf8f2
sudo cp
Oct 15, 2023
d0c2aff
sudo cp attempt
Oct 15, 2023
acec0e8
export LD_LIBRARY_PATH
Oct 15, 2023
a3c2e92
Add symbolic links
Oct 16, 2023
4a918cb
Install ocl-icd-opencl-dev
Oct 16, 2023
0636193
Re-add symbolic links
Oct 16, 2023
2a6eb12
Clean up debugging statements and workflows
Oct 27, 2023
e541c38
Merge pull request #32 from austinklein/ow-0.9.4
pgleeson Nov 9, 2023
e669543
Merge branch 'ow-0.9.4' into dev_test_ak
pgleeson Nov 16, 2023
9e2c201
Add test on Intel drivers
pgleeson Nov 16, 2023
5c23f5f
No clinfo for intel...
pgleeson Nov 16, 2023
264d0d7
Don't run test on intel
pgleeson Nov 16, 2023
1733c14
Merge pull request #33 from pgleeson/dev_test_ak
pgleeson Nov 16, 2023
6660922
Test on multiple pythons
pgleeson Nov 16, 2023
f831d4e
Only use native python (issue with installing/finding python3-dev)...…
pgleeson Nov 16, 2023
9d946c6
Need to checkout...
pgleeson Nov 16, 2023
0e7f82a
To v0.0.7; remove all debugging statements
pgleeson Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/ci-build-intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build using Intel drivers

on:
push:
branches: [ master, dev*, ow* ]
pull_request:
branches: [ master, dev, ow* ]

jobs:

build:

runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ ubuntu-latest, ubuntu-20.04 ]

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v3

- name: Install Intel OpenCL libraries needed for Sibernetic
run: |

lscpu

echo "Installing OpenCL Drivers"

# Based on: https://github.com/openworm/OpenWorm/blob/master/Dockerfile

mkdir intel-opencl-tmp
cd intel-opencl-tmp
mkdir intel-opencl
wget https://github.com/openworm/OpenWorm/raw/dev_inte/SRB5.0_linux64.zip
unzip SRB5.0_linux64.zip
tar -C intel-opencl -Jxf intel-opencl-r5.0-63503.x86_64.tar.xz
tar -C intel-opencl -Jxf intel-opencl-devel-r5.0-63503.x86_64.tar.xz
tar -C intel-opencl -Jxf intel-opencl-cpu-r5.0-63503.x86_64.tar.xz
sudo cp -R intel-opencl/* /
sudo ldconfig
cd ..
sudo rm -r intel-opencl-tmp

sudo cp -R /opt/intel/opencl/include/CL /usr/include/
sudo apt install -y ocl-icd-opencl-dev vim

echo "OpenCL Driver Installation Complete"


- name: Build Sibernetic
run: |

sudo apt install -y python3-dev freeglut3-dev libglu1-mesa-dev
#sudo apt install -y --allow-downgrades libc-bin=2.27-3ubuntu1.5 # Fails with 2.27-3ubuntu1.6 for some reason...
python -V
ls -alt /usr/bin/python*
ls -alt
make clean
make

- name: Print info on executable
run: |
ldd ./Release/Sibernetic

echo "NOTE: not running Sibernetic on GitHub actions test with Intel drivers. Seg faults."
###./Release/Sibernetic -no_g timelimit=0.001

- name: Final version info
run: |

python -V
pip list
67 changes: 43 additions & 24 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Sibernetic
name: Build using AMD drivers

on:
push:
Expand All @@ -14,36 +14,55 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: [ ubuntu-latest ]
runs-on: [ ubuntu-latest, ubuntu-20.04 ]

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Intel OpenCL libraries needed for Sibernetic
- name: Install AMD OpenCL libraries needed for Sibernetic
run: |

# Based on: https://github.com/openworm/OpenWorm/blob/master/Dockerfile
lscpu

mkdir intel-opencl-tmp
cd intel-opencl-tmp
mkdir intel-opencl
wget https://github.com/openworm/OpenWorm/raw/dev_inte/SRB5.0_linux64.zip
unzip SRB5.0_linux64.zip
tar -C intel-opencl -Jxf intel-opencl-r5.0-63503.x86_64.tar.xz
tar -C intel-opencl -Jxf intel-opencl-devel-r5.0-63503.x86_64.tar.xz
tar -C intel-opencl -Jxf intel-opencl-cpu-r5.0-63503.x86_64.tar.xz
sudo cp -R intel-opencl/* /
sudo ldconfig
cd ..
sudo rm -r intel-opencl-tmp

sudo cp -R /opt/intel/opencl/include/CL /usr/include/
sudo apt install -y ocl-icd-opencl-dev vim
echo "Installing OpenCL Drivers"

# Legacy install of Intel's OpenCL Drivers:
# Based on: https://github.com/openworm/OpenWorm/blob/master/Dockerfile
# mkdir intel-opencl-tmp
# cd intel-opencl-tmp
# mkdir intel-opencl
# wget https://github.com/openworm/OpenWorm/raw/dev_inte/SRB5.0_linux64.zip
# unzip SRB5.0_linux64.zip
# tar -C intel-opencl -Jxf intel-opencl-r5.0-63503.x86_64.tar.xz
# tar -C intel-opencl -Jxf intel-opencl-devel-r5.0-63503.x86_64.tar.xz
# tar -C intel-opencl -Jxf intel-opencl-cpu-r5.0-63503.x86_64.tar.xz
# sudo cp -R intel-opencl/* /
# sudo ldconfig
# cd ..
# sudo rm -r intel-opencl-tmp

# sudo cp -R /opt/intel/opencl/include/CL /usr/include/
# sudo apt install -y ocl-icd-opencl-dev vim

# 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
printf 'Y\n\n' | sudo ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh

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/libamdocl64.so /usr/lib/libamdocl64.so

sudo apt install -y ocl-icd-opencl-dev

echo "OpenCL Driver Installation Complete"

echo "CLINFO:"
clinfo

- name: Build Sibernetic
run: |
Expand Down
2 changes: 1 addition & 1 deletion sibernetic_c302.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pprint
pp = pprint.PrettyPrinter(indent=4)

script_version = '0.1.4' # This will change at different rate to C++ code...
script_version = '0.1.5' # This will change at different rate to C++ code...

DEFAULTS = {'duration': 2.0,
'dt': 0.005,
Expand Down
9 changes: 2 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool load_to = false;
bool skip_display_particles = false;
bool skip_display_membranes = false;
bool skip_display_connections = false;
std::string version = "0.0.6";
std::string version = "0.0.7";

int usage() {
std::cout
Expand Down Expand Up @@ -103,13 +103,11 @@ int usage() {
}

int main(int argc, char **argv) {
int exitStatus;
std::cout << "S1\n";
int exitStatus = -1;
if (argc == 1) {
std::cout << "Sibernetic: no arguments specified, run method executing\n";
exitStatus = run(argc, argv);
} else {
std::cout << "S1e\n";
bool graph = true;
bool run_tests = false;

Expand All @@ -135,7 +133,6 @@ int main(int argc, char **argv) {
0) { // run load config from file mode
graph = true;
load_from_file = true;
std::cout << "S1f\n";
}
if (std::string("-skip_display_particles").compare(argv[i]) == 0) {
skip_display_particles = true;
Expand All @@ -154,9 +151,7 @@ int main(int argc, char **argv) {
test_energy_conservation(argc, argv);
} else

std::cout << "S1r\n";
exitStatus = run(argc, argv, graph);
}
std::cout << "S1n\n";
return exitStatus;
}
26 changes: 10 additions & 16 deletions src/owOpenCLSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,11 @@ owOpenCLSolver::owOpenCLSolver(const float *position_cpp,
const int *membraneData_cpp,
const int *particleMembranesList_cpp) {
try {
std::cout << "owC1\n";
initializeOpenCL(config);
std::cout << "owC10\n";
// Create OpenCL buffers
initializeBuffers(position_cpp, velocity_cpp, config,
elasticConnectionsData_cpp, membraneData_cpp,
particleMembranesList_cpp);
std::cout << "owC1a\n";
// Create OpenCL kernels
create_ocl_kernel("clearBuffers", clearBuffers);
create_ocl_kernel("findNeighbors", findNeighbors);
Expand All @@ -91,14 +88,13 @@ owOpenCLSolver::owOpenCLSolver(const float *position_cpp,
pcisph_computeElasticForces);
// membrane handling kernels

std::cout << "owC1b\n";
create_ocl_kernel("clearMembraneBuffers", clearMembraneBuffers);
create_ocl_kernel("computeInteractionWithMembranes",
computeInteractionWithMembranes);
create_ocl_kernel("computeInteractionWithMembranes_finalize",
computeInteractionWithMembranes_finalize);
} catch (std::runtime_error &ex) {
std::cout << "errrr\n";
std::cout << "Error in owOpenCLSolver.cpp!!\n";
destroy();
throw;
}
Expand Down Expand Up @@ -239,18 +235,14 @@ void owOpenCLSolver::initializeBuffers(const float *position_cpp,
* Contain information about simulating configuration
*/
void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
std::cout << "owCi1\n";
cl_int err;
std::vector<cl::Platform> platformList;
std::cout << "owCi1a\n";
err = cl::Platform::get(
&platformList); // TODO make check that returned value isn't error
std::cout << "owCi1b\n";
if (platformList.size() < 1 || err != CL_SUCCESS) {
std::cout << "No OpenCL platforms found, error code: "<< err<< " \n";
throw std::runtime_error("No OpenCL platforms found");
}
std::cout << "owCi2\n";
char cBuffer[1024];
cl_platform_id cl_pl_id[10];
cl_uint n_pl;
Expand All @@ -262,12 +254,12 @@ void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
ciErrNum = clGetPlatformInfo(cl_pl_id[i], CL_PLATFORM_VERSION,
sz = sizeof(cBuffer), cBuffer, nullptr);
if (ciErrNum == CL_SUCCESS) {
printf(" CL_PLATFORM_VERSION [%d]: \t%s\n", i, cBuffer);
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\n";
// 0-CPU, 1-GPU // depends on the time order of system OpenCL drivers
// installation on your local machine
// CL_DEVICE_TYPE
Expand All @@ -287,6 +279,7 @@ void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
cl_uint device_coumpute_unit_num;
cl_uint device_coumpute_unit_num_current = 0;
unsigned int deviceNum = 0;

// Selection of more appropriate device
while (!findDevice) {
for (int clSelectedPlatformID = 0; clSelectedPlatformID < (int)n_pl;
Expand All @@ -297,8 +290,9 @@ void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
device_type[config->getDeviceType()], 0, nullptr,
&ciDeviceCount);
if ((devices_t = static_cast<cl_device_id *>(
malloc(sizeof(cl_device_id) * ciDeviceCount))) == nullptr)
malloc(sizeof(cl_device_id) * ciDeviceCount))) == nullptr) {
bPassed = false;
}
if (bPassed) {
result = clGetDeviceIDs(cl_pl_id[clSelectedPlatformID],
device_type[config->getDeviceType()],
Expand Down Expand Up @@ -335,12 +329,13 @@ 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;
if (config->getDeviceType() != ALL)
if (config->getDeviceType() != ALL) {
config->setDeviceType(ALL);
else
} else {
throw std::runtime_error("Sibernetic can't find any OpenCL devices. "
"Please check you're environment "
"configuration.");
}
}
}
cl_context_properties cprops[3] = {
Expand All @@ -357,8 +352,7 @@ void owOpenCLSolver::initializeOpenCL(owConfigProperty *config) {
&cBuffer); // CL_INVALID_VALUE = -30;
if (result == CL_SUCCESS) {
std::cout << "CL_CONTEXT_PLATFORM [" << plList << "]: CL_DEVICE_NAME ["
<< deviceNum << "]:\t" << cBuffer << "\n"
<< std::endl;
<< deviceNum << "]:\t" << cBuffer << std::endl << std::endl;
}
if (strlen(cBuffer) < 1000) {
config->setDeviceName(cBuffer);
Expand Down
4 changes: 0 additions & 4 deletions src/owPhysicsFluidSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,8 @@ owPhysicsFluidSimulator::owPhysicsFluidSimulator(owHelper *helper, int argc,
membraneData_cpp, particleMembranesList_cpp,
config); // Load configuration from file to buffer

std::cout << "owP1\n";
this->helper = helper;
std::cout << "owP1a\n";
if (config->numOfElasticP != 0) {
std::cout << "owP1b\n";
ocl_solver = new owOpenCLSolver(
position_cpp, velocity_cpp, config, elasticConnectionsData_cpp,
membraneData_cpp,
Expand All @@ -114,7 +111,6 @@ owPhysicsFluidSimulator::owPhysicsFluidSimulator(owHelper *helper, int argc,
throw;
}

std::cout << "owP2\n";
}
/** Reset simulation
*
Expand Down
1 change: 0 additions & 1 deletion src/owSignalSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ std::vector<float> SignalSimulator::run() {
// Call a method of the class
// pValue = PyObject_CallMethod(pInstance, "rrun
// un", nullptr);
std::cout << "S1s\n";
pValue = PyObject_CallMethod(pInstance, const_cast<char *>("run"), nullptr);
if (PyErr_Occurred()) {
PyErr_Print();
Expand Down
Loading