SlideShare a Scribd company logo
Make AI ecosystem
more interoperable
Kazuaki Ishizaki
IBM Research - Tokyo
About Me – Kazuaki Ishizaki
▪ Researcher at IBM Research – Tokyo
https://ibm.biz/ishizaki
– Compiler optimization, language runtime, and parallel processing
▪ Apache Spark committer from 2018/9 (SQL module)
▪ Work for IBM Java (Open J9, now) from 1996
– Technical lead for Just-in-time compiler for PowerPC
▪ ACM Distinguished Member
▪ SNS
– @kiszk
– https://www.slideshare.net/ishizaki/
2 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Agenda
▪ Motivation
▪ What is an inhibitor of interoperability?
– Endianness on each machine
▪ What is endian?
▪ What happens in a program?
▪ How to find and fix issues?
▪ How to keep interoperability in AI ecosystem
3 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Very Impressive Performance Improvement on x86
▪ Improve performance of Spark with Python by over 100x
4 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Source: https://databricks.com/blog/2017/10/30/introducing-vectorized-udfs-for-pyspark.html
Apache Spark uses
Apache Arrow
A cross-language
development platform
for in-memory analytics
I Want to Do This on IBM Z
5 Make AI ecosystem more interoperable - Kazuaki Ishizaki
$ bin/pyspark
...
>>> df.show()
Oh!!!
6 Make AI ecosystem more interoperable - Kazuaki Ishizaki
$ bin/pyspark
...
>>> df.show()
...
java.lang.IllegalStateException: Arrow only runs on LittleEndian systems…
...
>>>
Apache Arrow supported only Little Endian
7 Make AI ecosystem more interoperable - Kazuaki Ishizaki
$ bin/pyspark
...
>>> df.show()
...
java.lang.IllegalStateException: Arrow only runs on LittleEndian systems…
...
>>>
One Pager for Current AI Ecosystem
▪ Data can be exchanged among little endian machines (i.e. x86, Arm,
PowerLinux, …)
8 Make AI ecosystem more interoperable - Kazuaki Ishizaki
PowerLinux
Arm Origin: https://www.dremio.com/webinars/apache-arrow-in-theory-practice/
One Pager for Expected AI Ecosystem
▪ Data can be exchanged among both endian machines (i.e. x86, Arm, s390x,
PowerLinux, …)
9 Make AI ecosystem more interoperable - Kazuaki Ishizaki
PowerLinux
Arm
s390x
Origin: https://www.dremio.com/webinars/apache-arrow-in-theory-practice/
What is Endian?
▪ Data layout on a memory
– Example of integer 32bit value
10 Make AI ecosystem more interoperable - Kazuaki Ishizaki
0x01020304
What is Endian?
▪ Data layout on a memory
– Example of integer 32bit value
11 Make AI ecosystem more interoperable - Kazuaki Ishizaki
04
memory layout
Little endian
03
0x01020304
02 01
10
addr 11 12 13
x86_64, ppc64le, …
What is Endian?
▪ Data layout on a memory
– Example of integer 32bit value
12 Make AI ecosystem more interoperable - Kazuaki Ishizaki
04
memory layout
Little endian Big endian
03
0x01020304
02 01 01 02 03 04
memory layout
10
addr 11 12 13 10
addr 11 12 13
x86_64, ppc64le, … s390x
Why Programs Usually Work Well?
▪ Programs work well without special cares if
– No explicit memory access of a subset of data and/or of a super-set of data
– A program is closed itself (no data exchange with other machines)
13 Make AI ecosystem more interoperable - Kazuaki Ishizaki
int32_t a, b;
int16_t d;
...
int32_t c = a + b;
int16_t d = static_cast<int16_t>(c) + 1;
int32_t e = static_cast<int32_t>(d);
...
How to Find Issues on Different Endians?
▪ Find bad smells in source code
14 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Does It Have Bad Smell?
▪ Get 32-bit data from int8 datum by reinterpret_cast
15 Make AI ecosystem more interoperable - Kazuaki Ishizaki
uint8_t *i8p = ...
i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 3;
int32_t i32 = *reinterpret_cast<int32_t *>(i8p);
printf(“%08x”, i32);
Results are Different on Different Endian Machines
16 Make AI ecosystem more interoperable - Kazuaki Ishizaki
uint8_t *i8p = ...
i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 3;
int32_t i32 = *reinterpret_cast<int32_t *>(i8p);
printf(“%08x”, i32);
Little endian Big endian
01020304 04030201
Why Problem Occurs?
▪ Different endian processors interpret the same memory sequence in
different ways
17 Make AI ecosystem more interoperable - Kazuaki Ishizaki
04 03 02 01
04 03 02 01
memory layout
memory layout
04030201
01020304
uint8_t *i8p = ...
i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 1;
int32_t i32 = *reinterpret_cast<int32_t *>(i8p);
printf(“%08x”, i32);
Little endian Big endian
i8p i8p
Support Both Endians
▪ Swap data for big endian
18 Make AI ecosystem more interoperable - Kazuaki Ishizaki
uint8_t *i8p = ...;
i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 1;
int32_t i32 = reinterpret_cast<int32_t *>(i8p);
#if !defined(__LITTLE_ENDIAN__)
i32 = __builtin_bswap32(i32);
#endif
printf(“%08x”, i32);
Little endian Big endian
01020304 01020304
Support Both Endians in Java
▪ Swap data for big endian
19 Make AI ecosystem more interoperable - Kazuaki Ishizaki
static final boolean LITTLE_ENDIAN =
ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN;
int i32 = ... // get the value from a buffer
if (!LITTLE_ENDIAN) {
i32 = Integer.reverseBytes(i32);
}
Potential Bad Smell and Enhancements
▪ Intra-process (i.e. In-memory)
– Get data from the different data type
20 Make AI ecosystem more interoperable - Kazuaki Ishizaki
04 03 02 01
04 03 02 01
memory layout
memory layout
01020304
01020304 Swap
Potential Bad Smell and Enhancements
▪ Intra-process (i.e. In-memory)
– Get data from memory in different data type
▪ Inter-process (i.e. host – client)
– Exchange data with other machines
21 Make AI ecosystem more interoperable - Kazuaki Ishizaki
01 02 03 04
04 03 02 01
04 03 02 01
memory layout
memory layout
memory layout
04 03 02 01
memory layout
01020304
01020304
Swap
01020304
Swap
Can We Find All Issues?
▪ Find bad smells in source code
22 Make AI ecosystem more interoperable - Kazuaki Ishizaki
New code is coming everyday
Automatically Detect Issues
▪ Continuously run test cases on machines with different endians
23 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Run test cases
Automatically Detect Issues
▪ Continuously run test cases on machines with different endians
▪ Enhance code to support both endians if we find issues
24 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Run test cases Enhance code
CI Tools and Instances Help OSS Community
▪ TravisCI
▪ Jenkins
▪ Virtual machine instance
25 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Enhance code
Free Resources of Big Endian for OSS Community
▪ TravisCI
– https://docs.travis-ci.com/user/multi-cpu-architectures/
▪ Jenkins
– https://osuosl.org/services/ibm-z/
▪ Virtual machine instance
– https://developer.ibm.com/components/ibm-linuxone/gettingstarted/
26 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Apache Arrow Supports Both Endians
▪ Intra-process (from Apache Arrow 3.0)
– C and Java bindings
▪ Inter-process (from Apache Arrow 4.0)
– C bindings
27 Make AI ecosystem more interoperable - Kazuaki Ishizaki
CI on big ending is running for every PR update
Takeaway
▪ We know different endians on machines
– Little endian and big endian
▪ When do we take care of endians?
– Get a sub-set or super-set of data in memory
– Exchange data with other machines
▪ How to find potential issues and support both endians?
– Find bad smell
– Automatically run test cases
▪ How to keep interoperability in AI ecosystem?
– Easy and free to run CI on different types of machines
28 Make AI ecosystem more interoperable - Kazuaki Ishizaki
Visit https://www.slideshare.net/ishizaki if you are interested in this slide

More Related Content

PDF
In-Memory Evolution in Apache Spark
PDF
icpe2019_ishizaki_public
PDF
SparkTokyo2019
PDF
SQL Performance Improvements At a Glance in Apache Spark 3.0
PDF
Enabling Vectorized Engine in Apache Spark
PDF
Looking back at Spark 2.x and forward to 3.0
PPTX
Koalas: Unifying Spark and pandas APIs
PDF
Introducing Koalas 1.0 (and 1.1)
In-Memory Evolution in Apache Spark
icpe2019_ishizaki_public
SparkTokyo2019
SQL Performance Improvements At a Glance in Apache Spark 3.0
Enabling Vectorized Engine in Apache Spark
Looking back at Spark 2.x and forward to 3.0
Koalas: Unifying Spark and pandas APIs
Introducing Koalas 1.0 (and 1.1)

What's hot (20)

PDF
Deep Dive: Memory Management in Apache Spark
PDF
Project Tungsten: Bringing Spark Closer to Bare Metal
PDF
Getting The Best Performance With PySpark
PDF
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
PDF
Memory Management in Apache Spark
PDF
Intro to PySpark: Python Data Analysis at scale in the Cloud
PDF
Apache Spark Core – Practical Optimization
PDF
London Spark Meetup Project Tungsten Oct 12 2015
PPTX
Exploiting GPU's for Columnar DataFrrames by Kiran Lonikar
PDF
Elasticsearch And Apache Lucene For Apache Spark And MLlib
PDF
Spark Summit EU talk by Ted Malaska
PPTX
Scalable Machine Learning with PySpark
PPTX
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...
PPTX
Combining Machine Learning Frameworks with Apache Spark
PDF
Data stax academy
PDF
Structured Streaming for Columnar Data Warehouses with Jack Gudenkauf
PPTX
Frustration-Reduced PySpark: Data engineering with DataFrames
PDF
Spark performance tuning - Maksud Ibrahimov
PDF
PySpark in practice slides
PDF
Automated Spark Deployment With Declarative Infrastructure
Deep Dive: Memory Management in Apache Spark
Project Tungsten: Bringing Spark Closer to Bare Metal
Getting The Best Performance With PySpark
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
Memory Management in Apache Spark
Intro to PySpark: Python Data Analysis at scale in the Cloud
Apache Spark Core – Practical Optimization
London Spark Meetup Project Tungsten Oct 12 2015
Exploiting GPU's for Columnar DataFrrames by Kiran Lonikar
Elasticsearch And Apache Lucene For Apache Spark And MLlib
Spark Summit EU talk by Ted Malaska
Scalable Machine Learning with PySpark
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...
Combining Machine Learning Frameworks with Apache Spark
Data stax academy
Structured Streaming for Columnar Data Warehouses with Jack Gudenkauf
Frustration-Reduced PySpark: Data engineering with DataFrames
Spark performance tuning - Maksud Ibrahimov
PySpark in practice slides
Automated Spark Deployment With Declarative Infrastructure
Ad

Similar to Make AI ecosystem more interoperable (20)

PPT
Exadata architecture and internals presentation
PDF
digitaldesign-s20-lecture3b-fpga-afterlecture.pdf
ODP
Blades for HPTC
PDF
“Quantum” Performance Effects: beyond the Core
PDF
Azure Kubernetes Service - benefits and challenges
PDF
All Your IOPS Are Belong To Us - A Pinteresting Case Study in MySQL Performan...
PDF
Data Engineer's Lunch 90: Migrating SQL Data with Arcion
PDF
Transparent GPU Exploitation for Java
PDF
Big Data and OpenStack, a Love Story: Michael Still, Rackspace
PDF
Alto Desempenho com Java
PDF
An Enterprise Analytics Platform with Jupyter Notebooks and Apache Spark
PPTX
MySQL Performance Tuning 101 (Bahasa)
PDF
The Analytic Platform behind IBM’s Watson Data Platform - Big Data Spain 2017
PDF
Design for X: Exploring Product Design with Apache Spark and GraphLab
PPT
Resilience: the key requirement of a [big] [data] architecture - StampedeCon...
PDF
Streaming solutions for real time problems
PDF
How to deploy & optimize eZ Publish
PDF
20190615 hkos-mysql-troubleshootingandperformancev2
PPTX
Going open source with small teams
PPTX
Optimizing Hortonworks Apache Spark machine learning workloads for contempora...
Exadata architecture and internals presentation
digitaldesign-s20-lecture3b-fpga-afterlecture.pdf
Blades for HPTC
“Quantum” Performance Effects: beyond the Core
Azure Kubernetes Service - benefits and challenges
All Your IOPS Are Belong To Us - A Pinteresting Case Study in MySQL Performan...
Data Engineer's Lunch 90: Migrating SQL Data with Arcion
Transparent GPU Exploitation for Java
Big Data and OpenStack, a Love Story: Michael Still, Rackspace
Alto Desempenho com Java
An Enterprise Analytics Platform with Jupyter Notebooks and Apache Spark
MySQL Performance Tuning 101 (Bahasa)
The Analytic Platform behind IBM’s Watson Data Platform - Big Data Spain 2017
Design for X: Exploring Product Design with Apache Spark and GraphLab
Resilience: the key requirement of a [big] [data] architecture - StampedeCon...
Streaming solutions for real time problems
How to deploy & optimize eZ Publish
20190615 hkos-mysql-troubleshootingandperformancev2
Going open source with small teams
Optimizing Hortonworks Apache Spark machine learning workloads for contempora...
Ad

More from Kazuaki Ishizaki (17)

PDF
20230105_TITECH_lecture_ishizaki_public.pdf
PDF
20221226_TITECH_lecture_ishizaki_public.pdf
PDF
Introduction new features in Spark 3.0
PDF
SparkTokyo2019NovIshizaki
PDF
hscj2019_ishizaki_public
PDF
20180109 titech lecture_ishizaki_public
PDF
20171212 titech lecture_ishizaki_public
PDF
Demystifying DataFrame and Dataset
PDF
Making Hardware Accelerator Easier to Use
PDF
20160906 pplss ishizaki public
PDF
Exploiting GPUs in Spark
PDF
Easy and High Performance GPU Programming for Java Programmers
PDF
Exploiting GPUs in Spark
PDF
20151112 kutech lecture_ishizaki_public
PDF
20141224 titech lecture_ishizaki_public
PDF
Java Just-In-Timeコンパイラ
PDF
静的型付き言語用Just-In-Timeコンパイラの再利用による、動的型付き言語用コンパイラの実装と最適化
20230105_TITECH_lecture_ishizaki_public.pdf
20221226_TITECH_lecture_ishizaki_public.pdf
Introduction new features in Spark 3.0
SparkTokyo2019NovIshizaki
hscj2019_ishizaki_public
20180109 titech lecture_ishizaki_public
20171212 titech lecture_ishizaki_public
Demystifying DataFrame and Dataset
Making Hardware Accelerator Easier to Use
20160906 pplss ishizaki public
Exploiting GPUs in Spark
Easy and High Performance GPU Programming for Java Programmers
Exploiting GPUs in Spark
20151112 kutech lecture_ishizaki_public
20141224 titech lecture_ishizaki_public
Java Just-In-Timeコンパイラ
静的型付き言語用Just-In-Timeコンパイラの再利用による、動的型付き言語用コンパイラの実装と最適化

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Modernizing your data center with Dell and AMD
PPTX
Cloud computing and distributed systems.
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPT
Teaching material agriculture food technology
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
NewMind AI Monthly Chronicles - July 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Understanding_Digital_Forensics_Presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Modernizing your data center with Dell and AMD
Cloud computing and distributed systems.
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Chapter 3 Spatial Domain Image Processing.pdf
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Teaching material agriculture food technology

Make AI ecosystem more interoperable

  • 1. Make AI ecosystem more interoperable Kazuaki Ishizaki IBM Research - Tokyo
  • 2. About Me – Kazuaki Ishizaki ▪ Researcher at IBM Research – Tokyo https://ibm.biz/ishizaki – Compiler optimization, language runtime, and parallel processing ▪ Apache Spark committer from 2018/9 (SQL module) ▪ Work for IBM Java (Open J9, now) from 1996 – Technical lead for Just-in-time compiler for PowerPC ▪ ACM Distinguished Member ▪ SNS – @kiszk – https://www.slideshare.net/ishizaki/ 2 Make AI ecosystem more interoperable - Kazuaki Ishizaki
  • 3. Agenda ▪ Motivation ▪ What is an inhibitor of interoperability? – Endianness on each machine ▪ What is endian? ▪ What happens in a program? ▪ How to find and fix issues? ▪ How to keep interoperability in AI ecosystem 3 Make AI ecosystem more interoperable - Kazuaki Ishizaki
  • 4. Very Impressive Performance Improvement on x86 ▪ Improve performance of Spark with Python by over 100x 4 Make AI ecosystem more interoperable - Kazuaki Ishizaki Source: https://databricks.com/blog/2017/10/30/introducing-vectorized-udfs-for-pyspark.html Apache Spark uses Apache Arrow A cross-language development platform for in-memory analytics
  • 5. I Want to Do This on IBM Z 5 Make AI ecosystem more interoperable - Kazuaki Ishizaki $ bin/pyspark ... >>> df.show()
  • 6. Oh!!! 6 Make AI ecosystem more interoperable - Kazuaki Ishizaki $ bin/pyspark ... >>> df.show() ... java.lang.IllegalStateException: Arrow only runs on LittleEndian systems… ... >>>
  • 7. Apache Arrow supported only Little Endian 7 Make AI ecosystem more interoperable - Kazuaki Ishizaki $ bin/pyspark ... >>> df.show() ... java.lang.IllegalStateException: Arrow only runs on LittleEndian systems… ... >>>
  • 8. One Pager for Current AI Ecosystem ▪ Data can be exchanged among little endian machines (i.e. x86, Arm, PowerLinux, …) 8 Make AI ecosystem more interoperable - Kazuaki Ishizaki PowerLinux Arm Origin: https://www.dremio.com/webinars/apache-arrow-in-theory-practice/
  • 9. One Pager for Expected AI Ecosystem ▪ Data can be exchanged among both endian machines (i.e. x86, Arm, s390x, PowerLinux, …) 9 Make AI ecosystem more interoperable - Kazuaki Ishizaki PowerLinux Arm s390x Origin: https://www.dremio.com/webinars/apache-arrow-in-theory-practice/
  • 10. What is Endian? ▪ Data layout on a memory – Example of integer 32bit value 10 Make AI ecosystem more interoperable - Kazuaki Ishizaki 0x01020304
  • 11. What is Endian? ▪ Data layout on a memory – Example of integer 32bit value 11 Make AI ecosystem more interoperable - Kazuaki Ishizaki 04 memory layout Little endian 03 0x01020304 02 01 10 addr 11 12 13 x86_64, ppc64le, …
  • 12. What is Endian? ▪ Data layout on a memory – Example of integer 32bit value 12 Make AI ecosystem more interoperable - Kazuaki Ishizaki 04 memory layout Little endian Big endian 03 0x01020304 02 01 01 02 03 04 memory layout 10 addr 11 12 13 10 addr 11 12 13 x86_64, ppc64le, … s390x
  • 13. Why Programs Usually Work Well? ▪ Programs work well without special cares if – No explicit memory access of a subset of data and/or of a super-set of data – A program is closed itself (no data exchange with other machines) 13 Make AI ecosystem more interoperable - Kazuaki Ishizaki int32_t a, b; int16_t d; ... int32_t c = a + b; int16_t d = static_cast<int16_t>(c) + 1; int32_t e = static_cast<int32_t>(d); ...
  • 14. How to Find Issues on Different Endians? ▪ Find bad smells in source code 14 Make AI ecosystem more interoperable - Kazuaki Ishizaki
  • 15. Does It Have Bad Smell? ▪ Get 32-bit data from int8 datum by reinterpret_cast 15 Make AI ecosystem more interoperable - Kazuaki Ishizaki uint8_t *i8p = ... i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 3; int32_t i32 = *reinterpret_cast<int32_t *>(i8p); printf(“%08x”, i32);
  • 16. Results are Different on Different Endian Machines 16 Make AI ecosystem more interoperable - Kazuaki Ishizaki uint8_t *i8p = ... i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 3; int32_t i32 = *reinterpret_cast<int32_t *>(i8p); printf(“%08x”, i32); Little endian Big endian 01020304 04030201
  • 17. Why Problem Occurs? ▪ Different endian processors interpret the same memory sequence in different ways 17 Make AI ecosystem more interoperable - Kazuaki Ishizaki 04 03 02 01 04 03 02 01 memory layout memory layout 04030201 01020304 uint8_t *i8p = ... i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 1; int32_t i32 = *reinterpret_cast<int32_t *>(i8p); printf(“%08x”, i32); Little endian Big endian i8p i8p
  • 18. Support Both Endians ▪ Swap data for big endian 18 Make AI ecosystem more interoperable - Kazuaki Ishizaki uint8_t *i8p = ...; i8p[0] = 4; i8p[1] = 3; i8p[2] = 2; i8p[3] = 1; int32_t i32 = reinterpret_cast<int32_t *>(i8p); #if !defined(__LITTLE_ENDIAN__) i32 = __builtin_bswap32(i32); #endif printf(“%08x”, i32); Little endian Big endian 01020304 01020304
  • 19. Support Both Endians in Java ▪ Swap data for big endian 19 Make AI ecosystem more interoperable - Kazuaki Ishizaki static final boolean LITTLE_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN; int i32 = ... // get the value from a buffer if (!LITTLE_ENDIAN) { i32 = Integer.reverseBytes(i32); }
  • 20. Potential Bad Smell and Enhancements ▪ Intra-process (i.e. In-memory) – Get data from the different data type 20 Make AI ecosystem more interoperable - Kazuaki Ishizaki 04 03 02 01 04 03 02 01 memory layout memory layout 01020304 01020304 Swap
  • 21. Potential Bad Smell and Enhancements ▪ Intra-process (i.e. In-memory) – Get data from memory in different data type ▪ Inter-process (i.e. host – client) – Exchange data with other machines 21 Make AI ecosystem more interoperable - Kazuaki Ishizaki 01 02 03 04 04 03 02 01 04 03 02 01 memory layout memory layout memory layout 04 03 02 01 memory layout 01020304 01020304 Swap 01020304 Swap
  • 22. Can We Find All Issues? ▪ Find bad smells in source code 22 Make AI ecosystem more interoperable - Kazuaki Ishizaki New code is coming everyday
  • 23. Automatically Detect Issues ▪ Continuously run test cases on machines with different endians 23 Make AI ecosystem more interoperable - Kazuaki Ishizaki Run test cases
  • 24. Automatically Detect Issues ▪ Continuously run test cases on machines with different endians ▪ Enhance code to support both endians if we find issues 24 Make AI ecosystem more interoperable - Kazuaki Ishizaki Run test cases Enhance code
  • 25. CI Tools and Instances Help OSS Community ▪ TravisCI ▪ Jenkins ▪ Virtual machine instance 25 Make AI ecosystem more interoperable - Kazuaki Ishizaki Enhance code
  • 26. Free Resources of Big Endian for OSS Community ▪ TravisCI – https://docs.travis-ci.com/user/multi-cpu-architectures/ ▪ Jenkins – https://osuosl.org/services/ibm-z/ ▪ Virtual machine instance – https://developer.ibm.com/components/ibm-linuxone/gettingstarted/ 26 Make AI ecosystem more interoperable - Kazuaki Ishizaki
  • 27. Apache Arrow Supports Both Endians ▪ Intra-process (from Apache Arrow 3.0) – C and Java bindings ▪ Inter-process (from Apache Arrow 4.0) – C bindings 27 Make AI ecosystem more interoperable - Kazuaki Ishizaki CI on big ending is running for every PR update
  • 28. Takeaway ▪ We know different endians on machines – Little endian and big endian ▪ When do we take care of endians? – Get a sub-set or super-set of data in memory – Exchange data with other machines ▪ How to find potential issues and support both endians? – Find bad smell – Automatically run test cases ▪ How to keep interoperability in AI ecosystem? – Easy and free to run CI on different types of machines 28 Make AI ecosystem more interoperable - Kazuaki Ishizaki Visit https://www.slideshare.net/ishizaki if you are interested in this slide