SlideShare a Scribd company logo
write code and


fi
nd a job for it
Yung-Yu Chen

NTHU CSST, 21st June 2021
1
to our fellow coders
• We want to develop software

• We hope the code we write can feed us
(well!)

• … or we heard that software is eating the
world and we want to be on the side
eating but not eaten.

• it’s ok
Alesia Kazantceva: https://unsplash.com/photos/VWcPlbHglYc
2
who I am
• www.linkedin.com/in/yungyuc/

• R&D Engineer at Synopsys: synopsys.com

• Part-time teacher at NYCU CS: https://yyc.solvcon.net/en/latest/nsd/

• Experience:

• 4 years for computational
fl
uid dynamics (CFD) for aerospace

• 1 year in tsmc for optical proximity correction (OPC)

• 9 years in Synopsys for OPC

• 21 years writing C & C++

• 16 years writing Python ; active in Python communities in APAC for 10 years
3
principles
• You have a mission

• Jobs: what you do to get paid

• Career: the professional path to your
mission

• Everyone needs a mission

• A mission determines where you want to go

• Work for life

• because work is fun and it's easy to work
for 80 hours a week for things you are fully
engaged in
SpaceX: https://unsplash.com/photos/t3HVjP4xNsg
4
a new hire: characteristics
• What a team expects from a new hire.

• Know how to ask, to learn, to code, and
to adapt.

• To communicate by critical thinking matters
more than code.

• Programming language is just a language
happens to be understood by computers.

• Natural languages help programmers to
understand the problems. Programming
languages don’t.
To ask Seek to know that you do not know the
problems to solve, because you really do
not know
To learn Limit the scope; only learn the things
required for problem solving
To code Always get something working in
computers and make it reproducible by
everyone easily
To adapt Change yourselves through what you learn
Critical thinking and then critical discussions
5
what to learn
problems
technology
business
people
Computer programs are written to solve problems.


• How do users see and describe the problems?


• How do they want the problems to be solved?


• What are the counterpart of problems in computer science?
Technology is the way things are done, including the tools and methodologies.


Programmers need to be pro
fi
cient in the tools they use, including operating systems (and
computer hardware), editors, and programming languages.
Programmers need to know how the computer programs add value to the customers.


• Who are using the code?


• Why make the decision for buying the software?


• Who are the competitors and how do we position in the market?


• What are the landscape in the future?
Know who you work and compete with. Make friends with them. Remember their names.


• Your bosses and peers.


• Your upstream and downstream.


• People outside your organization.
6
focus on problems
• To get paid for coding, we need to solve
problems for your users.

• If you don't solve problems, you don't have
users.

• If you don't have users, you don't get paid.

• Generally speaking, solving di
ffi
cult problems
pays better.

• Di
ffi
cult problems take years to understand.
photoresist
silicon substrate
photomask
light source
Photolithography in semiconductor fabrication
wave length is only
hundreds of nm
image I want to
project on the PR
shape I need
on the mask
Optical proximity correction (OPC)
(smaller than the
wave length)
write code to
make it happen
7
Numerical simulations of conservation laws:

∂u
∂t
+
3
∑
k=1
∂F(k)
(u)
∂xk
= 0
di
ffi
culty
users & compe
ti
tors
work as a programmer
• Read a lot of code, mostly legacy

• New code doesn't sell

• (it may in the future, but we are not sure)

• Working code, no matter how old it is, is
much better than broken code

• Programming is life-long learning
8
write tests
• Do not trust your brain. Trust your tests.

• Have a system to automatically run tests for every checkins.

• Tests may be written before or after the features.

• The tests should be checked in along with the features.
Programmers are expected to know how to do version control. People who
program without version control are like monkeys hitting keyboards.


Non-programmers are NOT expected to know how to do version control. We
are not the center of the universe.


There are many version control systems. CVS, SVN, GIT, HG, P4, so on and so
forth. There is not the best system for version control. The system that is
currently working with your team's work
fl
ow is the best system.
9
maintain (old) code
• It something is not breaking, do not
fi
x it.

• Do not
fi
x problems that do not
exist.

• Source of bugs and where to
fi
nd
them.

• Technical debts got you a home
to live in the
fi
rst place.
10
Developers found
the issues
The
fi
xes can be planned
Users found the
issues
The
fi
xes need to happen as
soon as possible
coding errors
in
fl
exible design
misunderstood
requirements
lack of design
shortcut
approaches
lack of testing
...
write (new) code
11
collecting requirements
prototyping
architecture
design
plan for
testing
implementation
project management
seniority
juniors are here
how to get there: campus
• Campus is the perfect place for you to get prepared for a programming
job. There are plenty of opportunities to prove your potential.

• Get good grades: if you are smart in curricula, you probably are smart
enough to code.

• Teachers set clear scope in courses and de
fi
ne problems to solve.

• Teachers and TAs are paid to help you. Use them.

• You, the students, are responsible for building the link between the
curricula and the reality.
12
build your curricula
• Take courses that ask you to write a lot of code.

• To become a programmer, you need to program.

• Take courses for the mathematics and the theories behind computing.

• Abstract thinking helps you throughout the whole career.

• Take courses from enthusiastic teachers.

• It does not matter what they teach. What matters is how they teach.
13
build your resume
• Resumes are wrapping paper for the gift inside.

• What matters is the gift, but you must not use toilet paper to hold it.

• The resumes need to contain real things.

• Never lie in resumes; it's easy to detect.

• Start from day one in college.

• But it’s never to late to start.
14
resume contents
• Show them substantial contributions in one page.

• Term projects, research projects, thesis, side projects are all good.

• They need to be useful. Active users are solid proof for the usefulness. 

• Do not include irrelevant information. Do include numbers.
15
• How successful or helpful your projects were.

• How challenge they were.

• Project size and how well was your
teamwork.
• Family members, face picture, how you grew up,
hobbies, whatever private information.

• Words describing how much you are interested in the job.
Everyone knows that you want a job mostly for money.

• Self-assessed competency. It is always wrong and
makes you look like a clown.
Dos Donts
support your resume
• Resume is just one page of paper. To increase your
opportunities and help you in the interview, you need
supportive materials.

• That is code.

• Your coding projects should solve problems. Preferably
interesting (challenging) ones.

• Make presentations. Even if it’s an open-source project,
you cannot ask everyone to read your code.

• A well organized open-source project is good to have.
16
idea
prototype
execution
Show that you
can learn
Show that you
can act
Show that you
can organize and
teamwork
term projects
• Start form the well-known subjects (algorithms, data structures, database,
operating systems, compilers, mathematics, etc.)

• Seek use cases in two directions:

• What matters for the subjects

• What matters in the applications of the subjects

• Caveats in picking "practical" subjects: your lack of practical experience
forbids you from knowing what is really practical in the
fi
rst place
17
side projects
• Learn about your "pain points". Build tools that you will use daily.

• Find users for your projects. Your classmates, your friends, random
people online, anyone.

• Find your passion and enjoy it.

• It’s good and practical to start with what you are learning from the well-
known subjects.
18
internship
• Start as early as possible

• Yes, I am talking about NOW

• Practice writing resumes and interviewing for a job

• Do real-world projects and add them to resumes

• Caveat: industry do not take academic experience as real experience
19
community
• "It's about who you know, not what you know."

• ALWAYS start
fi
nding a job through your personal network before
submitting a resume online. (But you certainly need to have a nice resume
ready before anything.)

• Without people knowing you, it’s hard to get a good job.

• It's easier to
fi
nd good candidates from internal referrals! It's also easier
to get hired by that.

• What you know still matters more than who you know, because the skills
and knowledge you have determine who you will know.
20
networking
• Professional software development is a network of skilled professionals, working
together to accomplish the work.

• It's not about how good you are, but how much synergy you bring to the team.

• The engineering "system" is not just computers. It's the people plus the
machines.

• Participate in networking events: user groups, conferences, etc.

• Use the break time during sessions: it's meant for you to network.

• It is not uncommon for experienced professionals to focus on networking and
skip the whole technical sessions.
21
be pro-active
• If you are not pro-active in networking, how can others be convinced that you
will be pro-active in coding?

• Accurately assess your own capabilities and clearly present to others.

• Make technical presentation in technical conferences.

• Ready for hallway discussions.

• To justly express for yourself, you need to learn about the context and how
others think.

• It's hard and nobody gets it working in one shot. Practice!
22
career development
• Two ladders to climb:

• Technical: solve problems in the best ways.

• Management: make sure the team solves the right problems.

• Senior ranks in the technical track also requires substantial skills in
communication (with people), in additional to pro
fi
ciency in programming.

• The best ways to solve problems may not always be to write code.

• One usually needs to be good at coding before they know how to solve the
problems without it.
23
Thank you
24
next step: sciwork
• Sciwork (https://sciwork.dev/) is a community for researchers and engineers to share and discuss
computer code for scienti
fi
c, numerical, and engineering work.

• Use open source as a means to advance software development for computational sciences.

• Focus on code, open to applications, including academic, commercial, and anything.

• Activities:
25
Study and practice fundamental skills for code
development. For example, C++, Python, computer
architecture, system programming, parallel processing,
hybrid architecture, etc. Backbones like the nsd
course (https://yyc.solvcon.net/en/latest/nsd/) may be
used.
Meetups for people who want to contribute to one or a
set of projects to get together and code. The projects
are at the center of the event, and people joining a
sprint collaborate to move forward the projects. To
help attendees focus, there is ideally only one project
per sprint, bu it is not a rule set to stone.
Project sprints Study group
Introduce yourself in the discord lobby:
 https://discord.gg/6MAkFrD
Example of school training
26
numerical software
• Computer programs to solve scienti
fi
c or mathematic problems.

• Other names: Mathematical, scienti
fi
c, technical software.

• How does the code look like:

• Not visually pleasant. No graphical user interface.

• Knowledge-intensive, unintuitive to code.

• Computation-intensive, often incorporating parallelism, distributed computing, and
special hardware.

• Has a scripting layer. Python is popular for application experts to describe the
problems and solutions.
27
speed is the king
28
天下武功


無堅不破


唯快不破
course outline
29
Fundamental Engineering


Python and Numpy


C++ and Computer Architecture
Computer Fundamental
Matrix Operations


Cache Optimization


SIMD (Vector Processing)
Performance Considerations
Memory Management


Ownership and Smart Pointers


Modern C++
System management
C++ and C+ for Python


Array Code in C++


Advanced Python
Design Techniques
computer fundamental
30
Fundamental Engineering
Python and Numpy
C++ and Computer Architecture
• Automation


• Bash scripting


• Make
fi
le


• Cmake


• Organize automation


• Git version control


• Automatic testing


• Manual work


• Code review


• Timing
• Organize Python code


• Script


• Module & package


• Numpy


• Array meta data


• Multi-dimensional
arrays


• Array manipulation


• Numerical analysis


• Visualization (mpl)


• Linear algebra
• Compile & link


• Integer types


• Pointer and POD array


• Floating-point


• OOP


• Class


• Encapsulation


• Accessors


• Reference


• STL


• Polymorphism


• CRTP
performance considerations
31
Matrix Operations
Cache Optimization
SIMD (Vector Processing)
• POD arrays


• C++ matrix class


• Matrix operations


• Matrix-vector


• Matrix-matrix


• Linear algebra


• Linear system


• Eigen problems


• Least square
• Memory hierarchy


• Cache memory


• Access speed


• Locality


• Data layout


• Majoring


• Integer vs
fl
oating-
point


• Tiling
• Parallel processing


• Shared-memory


• Distributed-memory


• Vector processing


• SIMD instructions


• CPU capabilities


• Symbol table


• Speed measurement


• Common parallel
techniques
system management
32
Memory Management
Ownership and Smart Pointers
Modern C++
• Memory types


• C API


• Memory behavior


• C++ API


• Scalar allocation


• Array allocation


• Placement new


• STL allocator


• Instance counter
• Pointer and reference


• Raw pointer


• Null literal


• RAII


• Ownership


• Smart pointers


• Unique pointer


• Shared pointer


• Shared pointer


• Exclusive use


• Shared from this


• Circular reference
• Copy elision


• Move semantics


• Data concatenation


• Variadic template


• Perfect forwarding


• Lambda expression


• Closure
design Techniques
33
C++ and C for Python
Array Code in C++
Advanced Python
• What's in Python


• pybind11


• Cmake


• Custom wrapper


• pybind11


• Wrapping API


• Operating API


• CPython API


• Exception


• Python memory


• Small memory
• Python is slow


• Problem solving


• Numpy


• C++


• Other overheads


• Data preparation


• Speed-up by C++


• AOS vs SOA


• Dynamicity


• Scope-based timer
• Iterator


• Iterator protocol


• Generator


• Stack frame


• Meta path


• Descriptor


• Instance data


• Metaclass


• Class creation


• ABC


• Virtual base class
how to study
• Research online with documents and source code.

• Write code to practice.

• Lecture notes (https://yyc.solvcon.net/en/latest/nsd/) are provided for guidance.

• References:

• Computer Systems: A Programmer's Perspective, Randal E. Bryant and David R. O'Hallaron: https://
csapp.cs.cmu.edu/

• Python documentation: https://docs.python.org/3/

• Cppreference: https://en.cppreference.com/

• E
ff
ective Modern C++, Scott Meyer, O'Reilly, 2014

• Source code: cpython (https://github.com/python/cpython), numpy (https://github.com/numpy/numpy), and
pybind11 (https://github.com/pybind/pybind11).
34
how to develop
• Premise: Numerical software is developed to solve problems that are either impracticable or unmarketable without it.

• For the impracticable problems, numerical software simply enables the solution so that we can study them.
Problems in the
fi
elds of
fl
uid dynamics and astrophysics are usually of this kind.

• For the unmarketable problems, the software will signi
fi
cantly reduce the cost to solution. Machine learning,
visualization, communication, etc., are problems of this kind.

• Like developing any software, the true driver must be identi
fi
ed so that the system can be properly speci
fi
ed. After
that, there is a pattern in developing numerical software:

1. Observation

2. Generalize to a theory in math

3. Obtain analytical solutions for simple setup

4. Get stuck with complex setup

5. Numerical analysis comes to rescue

6. ... a lot of code development ...

7. Release a software package
35
hybrid architecture
• Numerical software usually uses a hybrid architecture to
achieve this.

• A fast, low-level computing engine.

• An easy-to-use, high-level scripting layer.

• It is usually developed as a platform, working like a library
that provides data structures and helpers for problem solving.

• The users will use the scripting layer to build applications.

• Assembly may be used in the low-level computing engine
to utilize every drop of hardware: Multi-core, multi-
threading, cache, vector processing, etc.
General structure
External result

(slides, reports, or papers)
Problem presentation

(physics, math, or equations)
Scripting or con
fi
guration
Library interface
Library structure
Computational kernel
36
architecture patterns
• Research code, the architecture is usually like:

• Problem presentation: high-level description, physics, and scripting / code con
fi
guration

• Library implementation

• Full-
fl
edge application

• For a commercial grade package, each of the layers will include more sub-layers. It is a
challenge to prevent those layers or sub-layers from interweaving. From users' point of
view, the sophistication appears in the problem presentation and the scripting layers.
Developers, on the other hand, take care of everything below problem presentation, so
that users can focus on problem solving.

• Scripting for modularization
37
C++ and Python
• Numerical software = C++ + Python

• Objective1: Fast and extremely
fl
exible in the same time.

• It should be
fl
exible enough so that users, i.e., scientists and engineers, can easily write
lengthy programs to control everything.

• Objective 2: Allow users to code without needing to know computer science, from the
beginning to end.

• The most suitable scripting language is Python, and the most suitable low-level language
may be C++.

• One may argue about the quali
fi
cation of C++ can, but considering the support it received
from the industry, it's probably di
ffi
cult to
fi
nd another language of higher acceptance.
38
more reasons for Python
• Python provides a better way to describe the physical or mathematical problems.

• Python can easily build an even higher-level application, using GUI, scripting, or both.

• Is there alternative for C++? No. For Python? Yes. But Python is the easiest choice
for its versatility and simplicity.

• A numerical software developer sees through the abstraction stack:

• The highest-level application is presented as a Python script.

• The Python script drives the number-crunching C++ library.

• C++ is the syntactic sugar for the machine code.
39
term project
• The term project helps you practice how to specify and design the
numerical software, in addition to writing the code.

• You should start to think about the project topic now (when the course
begins).

• You need to prepare a proposal and it helps you to plan.
40
proposal basics
• Proposal = plan

• Plan is subject to change!

• General structure

1. Basic information (including the GitHub repository)

2. Problem to solve

3. Perspective users

4. System architecture

5. API description

6. Engineering infrastructure

7. Schedule
41
project guidelines
42
Software Engineering Correctness
Software Architecture Presentation
Build system


Testing


Version control


History quality


Issue tracking


Documentation
Existence of golden


Quality of golden


Development procedure


Validation process
SOLID


API granularity and stability


High-level wrapping


Modularity


Pro
fi
ling


Runtime


Memory


Design for testing


Iterative design
Technical
fl
uency


Slide clarity


Time control


Appearance
discussions
• In-class discussions

• Ask questions to learn

• Online discussions

• For anything about the course note, open an issue in the note repository.

• For anything about the homework assignments, go to the corresponding GitHub
repository and open an issue there.

• For grades (of homework assignments or exam) that you see on E3, send me an E3
mail with [nsd] in the subject line.

• For anything else, send me an email at yyc@solvcon.net with [nsd] in the subject line.
43

More Related Content

Write code and find a job

  • 1. write code and 
 fi nd a job for it Yung-Yu Chen
 NTHU CSST, 21st June 2021 1
  • 2. to our fellow coders • We want to develop software • We hope the code we write can feed us (well!) • … or we heard that software is eating the world and we want to be on the side eating but not eaten. • it’s ok Alesia Kazantceva: https://unsplash.com/photos/VWcPlbHglYc 2
  • 3. who I am • www.linkedin.com/in/yungyuc/ • R&D Engineer at Synopsys: synopsys.com • Part-time teacher at NYCU CS: https://yyc.solvcon.net/en/latest/nsd/ • Experience: • 4 years for computational fl uid dynamics (CFD) for aerospace • 1 year in tsmc for optical proximity correction (OPC) • 9 years in Synopsys for OPC • 21 years writing C & C++ • 16 years writing Python ; active in Python communities in APAC for 10 years 3
  • 4. principles • You have a mission • Jobs: what you do to get paid • Career: the professional path to your mission • Everyone needs a mission • A mission determines where you want to go • Work for life • because work is fun and it's easy to work for 80 hours a week for things you are fully engaged in SpaceX: https://unsplash.com/photos/t3HVjP4xNsg 4
  • 5. a new hire: characteristics • What a team expects from a new hire. • Know how to ask, to learn, to code, and to adapt. • To communicate by critical thinking matters more than code. • Programming language is just a language happens to be understood by computers. • Natural languages help programmers to understand the problems. Programming languages don’t. To ask Seek to know that you do not know the problems to solve, because you really do not know To learn Limit the scope; only learn the things required for problem solving To code Always get something working in computers and make it reproducible by everyone easily To adapt Change yourselves through what you learn Critical thinking and then critical discussions 5
  • 6. what to learn problems technology business people Computer programs are written to solve problems. • How do users see and describe the problems? • How do they want the problems to be solved? • What are the counterpart of problems in computer science? Technology is the way things are done, including the tools and methodologies. Programmers need to be pro fi cient in the tools they use, including operating systems (and computer hardware), editors, and programming languages. Programmers need to know how the computer programs add value to the customers. • Who are using the code? • Why make the decision for buying the software? • Who are the competitors and how do we position in the market? • What are the landscape in the future? Know who you work and compete with. Make friends with them. Remember their names. • Your bosses and peers. • Your upstream and downstream. • People outside your organization. 6
  • 7. focus on problems • To get paid for coding, we need to solve problems for your users. • If you don't solve problems, you don't have users. • If you don't have users, you don't get paid. • Generally speaking, solving di ffi cult problems pays better. • Di ffi cult problems take years to understand. photoresist silicon substrate photomask light source Photolithography in semiconductor fabrication wave length is only hundreds of nm image I want to project on the PR shape I need on the mask Optical proximity correction (OPC) (smaller than the wave length) write code to make it happen 7 Numerical simulations of conservation laws: ∂u ∂t + 3 ∑ k=1 ∂F(k) (u) ∂xk = 0 di ffi culty users & compe ti tors
  • 8. work as a programmer • Read a lot of code, mostly legacy • New code doesn't sell • (it may in the future, but we are not sure) • Working code, no matter how old it is, is much better than broken code • Programming is life-long learning 8
  • 9. write tests • Do not trust your brain. Trust your tests. • Have a system to automatically run tests for every checkins. • Tests may be written before or after the features. • The tests should be checked in along with the features. Programmers are expected to know how to do version control. People who program without version control are like monkeys hitting keyboards. Non-programmers are NOT expected to know how to do version control. We are not the center of the universe. There are many version control systems. CVS, SVN, GIT, HG, P4, so on and so forth. There is not the best system for version control. The system that is currently working with your team's work fl ow is the best system. 9
  • 10. maintain (old) code • It something is not breaking, do not fi x it. • Do not fi x problems that do not exist. • Source of bugs and where to fi nd them. • Technical debts got you a home to live in the fi rst place. 10 Developers found the issues The fi xes can be planned Users found the issues The fi xes need to happen as soon as possible coding errors in fl exible design misunderstood requirements lack of design shortcut approaches lack of testing ...
  • 11. write (new) code 11 collecting requirements prototyping architecture design plan for testing implementation project management seniority juniors are here
  • 12. how to get there: campus • Campus is the perfect place for you to get prepared for a programming job. There are plenty of opportunities to prove your potential. • Get good grades: if you are smart in curricula, you probably are smart enough to code. • Teachers set clear scope in courses and de fi ne problems to solve. • Teachers and TAs are paid to help you. Use them. • You, the students, are responsible for building the link between the curricula and the reality. 12
  • 13. build your curricula • Take courses that ask you to write a lot of code. • To become a programmer, you need to program. • Take courses for the mathematics and the theories behind computing. • Abstract thinking helps you throughout the whole career. • Take courses from enthusiastic teachers. • It does not matter what they teach. What matters is how they teach. 13
  • 14. build your resume • Resumes are wrapping paper for the gift inside. • What matters is the gift, but you must not use toilet paper to hold it. • The resumes need to contain real things. • Never lie in resumes; it's easy to detect. • Start from day one in college. • But it’s never to late to start. 14
  • 15. resume contents • Show them substantial contributions in one page. • Term projects, research projects, thesis, side projects are all good. • They need to be useful. Active users are solid proof for the usefulness. • Do not include irrelevant information. Do include numbers. 15 • How successful or helpful your projects were. • How challenge they were. • Project size and how well was your teamwork. • Family members, face picture, how you grew up, hobbies, whatever private information. • Words describing how much you are interested in the job. Everyone knows that you want a job mostly for money. • Self-assessed competency. It is always wrong and makes you look like a clown. Dos Donts
  • 16. support your resume • Resume is just one page of paper. To increase your opportunities and help you in the interview, you need supportive materials. • That is code. • Your coding projects should solve problems. Preferably interesting (challenging) ones. • Make presentations. Even if it’s an open-source project, you cannot ask everyone to read your code. • A well organized open-source project is good to have. 16 idea prototype execution Show that you can learn Show that you can act Show that you can organize and teamwork
  • 17. term projects • Start form the well-known subjects (algorithms, data structures, database, operating systems, compilers, mathematics, etc.) • Seek use cases in two directions: • What matters for the subjects • What matters in the applications of the subjects • Caveats in picking "practical" subjects: your lack of practical experience forbids you from knowing what is really practical in the fi rst place 17
  • 18. side projects • Learn about your "pain points". Build tools that you will use daily. • Find users for your projects. Your classmates, your friends, random people online, anyone. • Find your passion and enjoy it. • It’s good and practical to start with what you are learning from the well- known subjects. 18
  • 19. internship • Start as early as possible • Yes, I am talking about NOW • Practice writing resumes and interviewing for a job • Do real-world projects and add them to resumes • Caveat: industry do not take academic experience as real experience 19
  • 20. community • "It's about who you know, not what you know." • ALWAYS start fi nding a job through your personal network before submitting a resume online. (But you certainly need to have a nice resume ready before anything.) • Without people knowing you, it’s hard to get a good job. • It's easier to fi nd good candidates from internal referrals! It's also easier to get hired by that. • What you know still matters more than who you know, because the skills and knowledge you have determine who you will know. 20
  • 21. networking • Professional software development is a network of skilled professionals, working together to accomplish the work. • It's not about how good you are, but how much synergy you bring to the team. • The engineering "system" is not just computers. It's the people plus the machines. • Participate in networking events: user groups, conferences, etc. • Use the break time during sessions: it's meant for you to network. • It is not uncommon for experienced professionals to focus on networking and skip the whole technical sessions. 21
  • 22. be pro-active • If you are not pro-active in networking, how can others be convinced that you will be pro-active in coding? • Accurately assess your own capabilities and clearly present to others. • Make technical presentation in technical conferences. • Ready for hallway discussions. • To justly express for yourself, you need to learn about the context and how others think. • It's hard and nobody gets it working in one shot. Practice! 22
  • 23. career development • Two ladders to climb: • Technical: solve problems in the best ways. • Management: make sure the team solves the right problems. • Senior ranks in the technical track also requires substantial skills in communication (with people), in additional to pro fi ciency in programming. • The best ways to solve problems may not always be to write code. • One usually needs to be good at coding before they know how to solve the problems without it. 23
  • 25. next step: sciwork • Sciwork (https://sciwork.dev/) is a community for researchers and engineers to share and discuss computer code for scienti fi c, numerical, and engineering work. • Use open source as a means to advance software development for computational sciences. • Focus on code, open to applications, including academic, commercial, and anything. • Activities: 25 Study and practice fundamental skills for code development. For example, C++, Python, computer architecture, system programming, parallel processing, hybrid architecture, etc. Backbones like the nsd course (https://yyc.solvcon.net/en/latest/nsd/) may be used. Meetups for people who want to contribute to one or a set of projects to get together and code. The projects are at the center of the event, and people joining a sprint collaborate to move forward the projects. To help attendees focus, there is ideally only one project per sprint, bu it is not a rule set to stone. Project sprints Study group Introduce yourself in the discord lobby:
 https://discord.gg/6MAkFrD
  • 26. Example of school training 26
  • 27. numerical software • Computer programs to solve scienti fi c or mathematic problems. • Other names: Mathematical, scienti fi c, technical software. • How does the code look like: • Not visually pleasant. No graphical user interface. • Knowledge-intensive, unintuitive to code. • Computation-intensive, often incorporating parallelism, distributed computing, and special hardware. • Has a scripting layer. Python is popular for application experts to describe the problems and solutions. 27
  • 28. speed is the king 28 天下武功 無堅不破 唯快不破
  • 29. course outline 29 Fundamental Engineering Python and Numpy C++ and Computer Architecture Computer Fundamental Matrix Operations Cache Optimization SIMD (Vector Processing) Performance Considerations Memory Management Ownership and Smart Pointers Modern C++ System management C++ and C+ for Python Array Code in C++ Advanced Python Design Techniques
  • 30. computer fundamental 30 Fundamental Engineering Python and Numpy C++ and Computer Architecture • Automation • Bash scripting • Make fi le • Cmake • Organize automation • Git version control • Automatic testing • Manual work • Code review • Timing • Organize Python code • Script • Module & package • Numpy • Array meta data • Multi-dimensional arrays • Array manipulation • Numerical analysis • Visualization (mpl) • Linear algebra • Compile & link • Integer types • Pointer and POD array • Floating-point • OOP • Class • Encapsulation • Accessors • Reference • STL • Polymorphism • CRTP
  • 31. performance considerations 31 Matrix Operations Cache Optimization SIMD (Vector Processing) • POD arrays • C++ matrix class • Matrix operations • Matrix-vector • Matrix-matrix • Linear algebra • Linear system • Eigen problems • Least square • Memory hierarchy • Cache memory • Access speed • Locality • Data layout • Majoring • Integer vs fl oating- point • Tiling • Parallel processing • Shared-memory • Distributed-memory • Vector processing • SIMD instructions • CPU capabilities • Symbol table • Speed measurement • Common parallel techniques
  • 32. system management 32 Memory Management Ownership and Smart Pointers Modern C++ • Memory types • C API • Memory behavior • C++ API • Scalar allocation • Array allocation • Placement new • STL allocator • Instance counter • Pointer and reference • Raw pointer • Null literal • RAII • Ownership • Smart pointers • Unique pointer • Shared pointer • Shared pointer • Exclusive use • Shared from this • Circular reference • Copy elision • Move semantics • Data concatenation • Variadic template • Perfect forwarding • Lambda expression • Closure
  • 33. design Techniques 33 C++ and C for Python Array Code in C++ Advanced Python • What's in Python • pybind11 • Cmake • Custom wrapper • pybind11 • Wrapping API • Operating API • CPython API • Exception • Python memory • Small memory • Python is slow • Problem solving • Numpy • C++ • Other overheads • Data preparation • Speed-up by C++ • AOS vs SOA • Dynamicity • Scope-based timer • Iterator • Iterator protocol • Generator • Stack frame • Meta path • Descriptor • Instance data • Metaclass • Class creation • ABC • Virtual base class
  • 34. how to study • Research online with documents and source code. • Write code to practice. • Lecture notes (https://yyc.solvcon.net/en/latest/nsd/) are provided for guidance. • References: • Computer Systems: A Programmer's Perspective, Randal E. Bryant and David R. O'Hallaron: https:// csapp.cs.cmu.edu/ • Python documentation: https://docs.python.org/3/ • Cppreference: https://en.cppreference.com/ • E ff ective Modern C++, Scott Meyer, O'Reilly, 2014 • Source code: cpython (https://github.com/python/cpython), numpy (https://github.com/numpy/numpy), and pybind11 (https://github.com/pybind/pybind11). 34
  • 35. how to develop • Premise: Numerical software is developed to solve problems that are either impracticable or unmarketable without it. • For the impracticable problems, numerical software simply enables the solution so that we can study them. Problems in the fi elds of fl uid dynamics and astrophysics are usually of this kind. • For the unmarketable problems, the software will signi fi cantly reduce the cost to solution. Machine learning, visualization, communication, etc., are problems of this kind. • Like developing any software, the true driver must be identi fi ed so that the system can be properly speci fi ed. After that, there is a pattern in developing numerical software: 1. Observation 2. Generalize to a theory in math 3. Obtain analytical solutions for simple setup 4. Get stuck with complex setup 5. Numerical analysis comes to rescue 6. ... a lot of code development ... 7. Release a software package 35
  • 36. hybrid architecture • Numerical software usually uses a hybrid architecture to achieve this. • A fast, low-level computing engine. • An easy-to-use, high-level scripting layer. • It is usually developed as a platform, working like a library that provides data structures and helpers for problem solving. • The users will use the scripting layer to build applications. • Assembly may be used in the low-level computing engine to utilize every drop of hardware: Multi-core, multi- threading, cache, vector processing, etc. General structure External result (slides, reports, or papers) Problem presentation
 (physics, math, or equations) Scripting or con fi guration Library interface Library structure Computational kernel 36
  • 37. architecture patterns • Research code, the architecture is usually like: • Problem presentation: high-level description, physics, and scripting / code con fi guration • Library implementation • Full- fl edge application • For a commercial grade package, each of the layers will include more sub-layers. It is a challenge to prevent those layers or sub-layers from interweaving. From users' point of view, the sophistication appears in the problem presentation and the scripting layers. Developers, on the other hand, take care of everything below problem presentation, so that users can focus on problem solving. • Scripting for modularization 37
  • 38. C++ and Python • Numerical software = C++ + Python • Objective1: Fast and extremely fl exible in the same time. • It should be fl exible enough so that users, i.e., scientists and engineers, can easily write lengthy programs to control everything. • Objective 2: Allow users to code without needing to know computer science, from the beginning to end. • The most suitable scripting language is Python, and the most suitable low-level language may be C++. • One may argue about the quali fi cation of C++ can, but considering the support it received from the industry, it's probably di ffi cult to fi nd another language of higher acceptance. 38
  • 39. more reasons for Python • Python provides a better way to describe the physical or mathematical problems. • Python can easily build an even higher-level application, using GUI, scripting, or both. • Is there alternative for C++? No. For Python? Yes. But Python is the easiest choice for its versatility and simplicity. • A numerical software developer sees through the abstraction stack: • The highest-level application is presented as a Python script. • The Python script drives the number-crunching C++ library. • C++ is the syntactic sugar for the machine code. 39
  • 40. term project • The term project helps you practice how to specify and design the numerical software, in addition to writing the code. • You should start to think about the project topic now (when the course begins). • You need to prepare a proposal and it helps you to plan. 40
  • 41. proposal basics • Proposal = plan • Plan is subject to change! • General structure 1. Basic information (including the GitHub repository) 2. Problem to solve 3. Perspective users 4. System architecture 5. API description 6. Engineering infrastructure 7. Schedule 41
  • 42. project guidelines 42 Software Engineering Correctness Software Architecture Presentation Build system Testing Version control 
 History quality Issue tracking Documentation Existence of golden Quality of golden Development procedure Validation process SOLID API granularity and stability High-level wrapping Modularity Pro fi ling Runtime Memory Design for testing Iterative design Technical fl uency Slide clarity Time control Appearance
  • 43. discussions • In-class discussions • Ask questions to learn • Online discussions • For anything about the course note, open an issue in the note repository. • For anything about the homework assignments, go to the corresponding GitHub repository and open an issue there. • For grades (of homework assignments or exam) that you see on E3, send me an E3 mail with [nsd] in the subject line. • For anything else, send me an email at yyc@solvcon.net with [nsd] in the subject line. 43